@ledgerhq/coin-canton 0.7.0 → 0.8.0-nightly.1

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 (133) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +26 -0
  3. package/lib/api/index.d.ts.map +1 -1
  4. package/lib/api/index.js +3 -0
  5. package/lib/api/index.js.map +1 -1
  6. package/lib/api/lastBlock.integ.test.js +0 -15
  7. package/lib/api/lastBlock.integ.test.js.map +1 -1
  8. package/lib/bridge/getTransactionStatus.test.d.ts +2 -0
  9. package/lib/bridge/getTransactionStatus.test.d.ts.map +1 -0
  10. package/lib/bridge/getTransactionStatus.test.js +365 -0
  11. package/lib/bridge/getTransactionStatus.test.js.map +1 -0
  12. package/lib/bridge/index.d.ts.map +1 -1
  13. package/lib/bridge/index.js +5 -5
  14. package/lib/bridge/index.js.map +1 -1
  15. package/lib/bridge/onboard.d.ts +11 -6
  16. package/lib/bridge/onboard.d.ts.map +1 -1
  17. package/lib/bridge/onboard.integ.test.js +49 -27
  18. package/lib/bridge/onboard.integ.test.js.map +1 -1
  19. package/lib/bridge/onboard.js +45 -152
  20. package/lib/bridge/onboard.js.map +1 -1
  21. package/lib/bridge/signOperation.d.ts.map +1 -1
  22. package/lib/bridge/signOperation.js +5 -5
  23. package/lib/bridge/signOperation.js.map +1 -1
  24. package/lib/bridge/sync.d.ts +3 -2
  25. package/lib/bridge/sync.d.ts.map +1 -1
  26. package/lib/bridge/sync.integ.test.js +39 -17
  27. package/lib/bridge/sync.integ.test.js.map +1 -1
  28. package/lib/bridge/sync.js +71 -57
  29. package/lib/bridge/sync.js.map +1 -1
  30. package/lib/common-logic/utils.d.ts.map +1 -1
  31. package/lib/common-logic/utils.js +3 -1
  32. package/lib/common-logic/utils.js.map +1 -1
  33. package/lib/common-logic/utils.test.d.ts +2 -0
  34. package/lib/common-logic/utils.test.d.ts.map +1 -0
  35. package/lib/common-logic/utils.test.js +104 -0
  36. package/lib/common-logic/utils.test.js.map +1 -0
  37. package/lib/config.d.ts +1 -1
  38. package/lib/config.d.ts.map +1 -1
  39. package/lib/network/gateway.d.ts +14 -10
  40. package/lib/network/gateway.d.ts.map +1 -1
  41. package/lib/network/gateway.integ.test.js +31 -17
  42. package/lib/network/gateway.integ.test.js.map +1 -1
  43. package/lib/network/gateway.js +34 -16
  44. package/lib/network/gateway.js.map +1 -1
  45. package/lib/network/gateway.test.d.ts +2 -0
  46. package/lib/network/gateway.test.d.ts.map +1 -0
  47. package/lib/network/gateway.test.js +59 -0
  48. package/lib/network/gateway.test.js.map +1 -0
  49. package/lib/types/bridge.d.ts +6 -16
  50. package/lib/types/bridge.d.ts.map +1 -1
  51. package/lib/types/onboard.d.ts +5 -5
  52. package/lib/types/onboard.d.ts.map +1 -1
  53. package/lib/types/onboard.js +10 -10
  54. package/lib/types/onboard.js.map +1 -1
  55. package/lib-es/api/index.d.ts.map +1 -1
  56. package/lib-es/api/index.js +3 -0
  57. package/lib-es/api/index.js.map +1 -1
  58. package/lib-es/api/lastBlock.integ.test.js +0 -15
  59. package/lib-es/api/lastBlock.integ.test.js.map +1 -1
  60. package/lib-es/bridge/getTransactionStatus.test.d.ts +2 -0
  61. package/lib-es/bridge/getTransactionStatus.test.d.ts.map +1 -0
  62. package/lib-es/bridge/getTransactionStatus.test.js +360 -0
  63. package/lib-es/bridge/getTransactionStatus.test.js.map +1 -0
  64. package/lib-es/bridge/index.d.ts.map +1 -1
  65. package/lib-es/bridge/index.js +6 -6
  66. package/lib-es/bridge/index.js.map +1 -1
  67. package/lib-es/bridge/onboard.d.ts +11 -6
  68. package/lib-es/bridge/onboard.d.ts.map +1 -1
  69. package/lib-es/bridge/onboard.integ.test.js +37 -15
  70. package/lib-es/bridge/onboard.integ.test.js.map +1 -1
  71. package/lib-es/bridge/onboard.js +44 -152
  72. package/lib-es/bridge/onboard.js.map +1 -1
  73. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  74. package/lib-es/bridge/signOperation.js +5 -5
  75. package/lib-es/bridge/signOperation.js.map +1 -1
  76. package/lib-es/bridge/sync.d.ts +3 -2
  77. package/lib-es/bridge/sync.d.ts.map +1 -1
  78. package/lib-es/bridge/sync.integ.test.js +34 -12
  79. package/lib-es/bridge/sync.integ.test.js.map +1 -1
  80. package/lib-es/bridge/sync.js +71 -56
  81. package/lib-es/bridge/sync.js.map +1 -1
  82. package/lib-es/common-logic/utils.d.ts.map +1 -1
  83. package/lib-es/common-logic/utils.js +3 -1
  84. package/lib-es/common-logic/utils.js.map +1 -1
  85. package/lib-es/common-logic/utils.test.d.ts +2 -0
  86. package/lib-es/common-logic/utils.test.d.ts.map +1 -0
  87. package/lib-es/common-logic/utils.test.js +99 -0
  88. package/lib-es/common-logic/utils.test.js.map +1 -0
  89. package/lib-es/config.d.ts +1 -1
  90. package/lib-es/config.d.ts.map +1 -1
  91. package/lib-es/network/gateway.d.ts +14 -10
  92. package/lib-es/network/gateway.d.ts.map +1 -1
  93. package/lib-es/network/gateway.integ.test.js +31 -17
  94. package/lib-es/network/gateway.integ.test.js.map +1 -1
  95. package/lib-es/network/gateway.js +34 -16
  96. package/lib-es/network/gateway.js.map +1 -1
  97. package/lib-es/network/gateway.test.d.ts +2 -0
  98. package/lib-es/network/gateway.test.d.ts.map +1 -0
  99. package/lib-es/network/gateway.test.js +54 -0
  100. package/lib-es/network/gateway.test.js.map +1 -0
  101. package/lib-es/types/bridge.d.ts +6 -16
  102. package/lib-es/types/bridge.d.ts.map +1 -1
  103. package/lib-es/types/onboard.d.ts +5 -5
  104. package/lib-es/types/onboard.d.ts.map +1 -1
  105. package/lib-es/types/onboard.js +9 -9
  106. package/lib-es/types/onboard.js.map +1 -1
  107. package/package.json +8 -7
  108. package/src/api/index.ts +9 -0
  109. package/src/api/lastBlock.integ.test.ts +0 -18
  110. package/src/bridge/getTransactionStatus.test.ts +446 -0
  111. package/src/bridge/index.ts +6 -6
  112. package/src/bridge/onboard.integ.test.ts +44 -31
  113. package/src/bridge/onboard.ts +61 -209
  114. package/src/bridge/signOperation.ts +5 -6
  115. package/src/bridge/sync.integ.test.ts +38 -13
  116. package/src/bridge/sync.ts +90 -72
  117. package/src/common-logic/utils.test.ts +108 -0
  118. package/src/common-logic/utils.ts +4 -1
  119. package/src/config.ts +1 -1
  120. package/src/network/gateway.integ.test.ts +48 -21
  121. package/src/network/gateway.test.ts +66 -0
  122. package/src/network/gateway.ts +60 -37
  123. package/src/types/bridge.ts +8 -19
  124. package/src/types/onboard.ts +5 -5
  125. package/lib/bridge/serialization.d.ts +0 -4
  126. package/lib/bridge/serialization.d.ts.map +0 -1
  127. package/lib/bridge/serialization.js +0 -31
  128. package/lib/bridge/serialization.js.map +0 -1
  129. package/lib-es/bridge/serialization.d.ts +0 -4
  130. package/lib-es/bridge/serialization.d.ts.map +0 -1
  131. package/lib-es/bridge/serialization.js +0 -27
  132. package/lib-es/bridge/serialization.js.map +0 -1
  133. package/src/bridge/serialization.ts +0 -36
@@ -11,7 +11,7 @@ import {
11
11
  } from "../types/onboard";
12
12
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
13
13
 
14
- type OnboardingPrepareResponse = {
14
+ export type OnboardingPrepareResponse = {
15
15
  party_id: string;
16
16
  party_name: string;
17
17
  public_key_fingerprint: string;
@@ -75,9 +75,17 @@ type TransactionSubmitRequest = {
75
75
 
76
76
  type TransactionSubmitResponse = { update_id: string };
77
77
 
78
+ export type GetBalanceResponse =
79
+ | {
80
+ at_round: number;
81
+ balances: InstrumentBalance[];
82
+ }
83
+ // temporary backwards compatibility
84
+ | InstrumentBalance[];
85
+
78
86
  export type InstrumentBalance = {
79
87
  instrument_id: string;
80
- amount: number;
88
+ amount: string;
81
89
  locked: boolean;
82
90
  };
83
91
 
@@ -274,7 +282,7 @@ export type OperationInfo =
274
282
 
275
283
  const getGatewayUrl = (currency: CryptoCurrency) => coinConfig.getCoinConfig(currency).gatewayUrl;
276
284
  const getNodeId = (currency: CryptoCurrency) =>
277
- coinConfig.getCoinConfig(currency).nodeId || "ledger-devnet-stg";
285
+ coinConfig.getCoinConfig(currency).nodeId || "ledger-live-devnet";
278
286
  const getNetworkType = (currency: CryptoCurrency) => coinConfig.getCoinConfig(currency).networkType;
279
287
 
280
288
  const gatewayNetwork = <T, U = unknown>(req: LiveNetworkRequest<U>) => {
@@ -288,11 +296,7 @@ const gatewayNetwork = <T, U = unknown>(req: LiveNetworkRequest<U>) => {
288
296
  });
289
297
  };
290
298
 
291
- export async function prepareOnboarding(
292
- currency: CryptoCurrency,
293
- pubKey: string,
294
- pubKeyType: string,
295
- ): Promise<OnboardingPrepareResponse> {
299
+ export async function prepareOnboarding(currency: CryptoCurrency, pubKey: string) {
296
300
  const gatewayUrl = getGatewayUrl(currency);
297
301
  const nodeId = getNodeId(currency);
298
302
  const fullUrl = `${gatewayUrl}/v1/node/${nodeId}/onboarding/prepare`;
@@ -302,29 +306,54 @@ export async function prepareOnboarding(
302
306
  url: fullUrl,
303
307
  data: {
304
308
  public_key: pubKey,
305
- public_key_type: pubKeyType,
309
+ public_key_type: "ed25519",
306
310
  },
307
311
  });
308
312
 
309
313
  return data;
310
314
  }
311
315
 
316
+ type OnboardingSubmitError409 = {
317
+ partyId: string;
318
+ status: 409;
319
+ type: "PARTY_ALREADY_EXISTS";
320
+ message: string;
321
+ };
322
+
312
323
  export async function submitOnboarding(
313
324
  currency: CryptoCurrency,
314
- prepareRequest: OnboardingPrepareRequest,
325
+ publicKey: string,
315
326
  prepareResponse: OnboardingPrepareResponse,
316
327
  signature: string,
317
328
  ) {
318
- const { data } = await gatewayNetwork<OnboardingSubmitResponse, OnboardingSubmitRequest>({
319
- method: "POST",
320
- url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/onboarding/submit`,
321
- data: {
322
- prepare_request: prepareRequest,
323
- prepare_response: prepareResponse,
324
- signature,
325
- },
326
- });
327
- return data;
329
+ try {
330
+ const { data } = await gatewayNetwork<OnboardingSubmitResponse, OnboardingSubmitRequest>({
331
+ method: "POST",
332
+ url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/onboarding/submit`,
333
+ data: {
334
+ prepare_request: {
335
+ public_key: publicKey,
336
+ public_key_type: "ed25519",
337
+ },
338
+ prepare_response: prepareResponse,
339
+ signature,
340
+ },
341
+ });
342
+ return data;
343
+ } catch (e) {
344
+ if (e instanceof Error && "type" in e && e.type === "PARTY_ALREADY_EXISTS") {
345
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
346
+ const { partyId } = e as unknown as OnboardingSubmitError409;
347
+ return {
348
+ party: {
349
+ party_id: partyId,
350
+ public_key: publicKey,
351
+ },
352
+ };
353
+ }
354
+
355
+ throw e;
356
+ }
328
357
  }
329
358
 
330
359
  export async function submit(
@@ -344,15 +373,12 @@ export async function submit(
344
373
  return data;
345
374
  }
346
375
 
347
- export async function getBalance(
348
- currency: CryptoCurrency,
349
- partyId: string,
350
- ): Promise<InstrumentBalance[]> {
351
- const { data } = await gatewayNetwork<InstrumentBalance[]>({
376
+ export async function getBalance(currency: CryptoCurrency, partyId: string) {
377
+ const { data } = await gatewayNetwork<GetBalanceResponse>({
352
378
  method: "GET",
353
379
  url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/balance`,
354
380
  });
355
- return data;
381
+ return Array.isArray(data) ? data : data.balances;
356
382
  }
357
383
 
358
384
  export async function getPartyById(currency: CryptoCurrency, partyId: string): Promise<PartyInfo> {
@@ -421,7 +447,7 @@ enum TransactionType {
421
447
  export async function prepareTapRequest(
422
448
  currency: CryptoCurrency,
423
449
  { partyId, amount = 1000000 }: PrepareTapRequest,
424
- ): Promise<PrepareTapResponse> {
450
+ ) {
425
451
  if (getNetworkType(currency) === "mainnet") {
426
452
  return {
427
453
  serialized: "",
@@ -429,11 +455,11 @@ export async function prepareTapRequest(
429
455
  hash: "",
430
456
  };
431
457
  }
432
- const { data } = await gatewayNetwork<PrepareTapResponse, { amount: number; type: string }>({
458
+ const { data } = await gatewayNetwork<PrepareTapResponse, { amount: string; type: string }>({
433
459
  method: "POST",
434
460
  url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/transaction/prepare`,
435
461
  data: {
436
- amount: parseInt(amount.toString(), 10), // Convert to integer to avoid scientific notation
462
+ amount: amount.toString(),
437
463
  type: TransactionType.TAP_REQUEST,
438
464
  },
439
465
  });
@@ -454,7 +480,7 @@ type SubmitTapRequestResponse = {
454
480
  export async function submitTapRequest(
455
481
  currency: CryptoCurrency,
456
482
  { partyId, serialized, signature }: SubmitTapRequestRequest,
457
- ): Promise<SubmitTapRequestResponse> {
483
+ ) {
458
484
  const { data } = await gatewayNetwork<
459
485
  SubmitTapRequestResponse,
460
486
  Omit<SubmitTapRequestRequest, "partyId">
@@ -473,7 +499,7 @@ export async function prepareTransferRequest(
473
499
  currency: CryptoCurrency,
474
500
  partyId: string,
475
501
  params: PrepareTransferRequest,
476
- ): Promise<PrepareTransferResponse> {
502
+ ) {
477
503
  const { data } = await gatewayNetwork<PrepareTransferResponse, PrepareTransferRequest>({
478
504
  method: "POST",
479
505
  url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/transaction/prepare`,
@@ -490,10 +516,7 @@ export async function getLedgerEnd(currency: CryptoCurrency): Promise<number> {
490
516
  return data;
491
517
  }
492
518
 
493
- export async function preparePreApprovalTransaction(
494
- currency: CryptoCurrency,
495
- partyId: string,
496
- ): Promise<PrepareTransactionResponse> {
519
+ export async function preparePreApprovalTransaction(currency: CryptoCurrency, partyId: string) {
497
520
  const { data } = await gatewayNetwork<PrepareTransactionResponse, PrepareTransactionRequest>({
498
521
  method: "POST",
499
522
  url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/transaction/prepare`,
@@ -510,7 +533,7 @@ export async function submitPreApprovalTransaction(
510
533
  partyId: string,
511
534
  { serialized }: PrepareTransactionResponse,
512
535
  signature: string,
513
- ): Promise<PreApprovalResult> {
536
+ ) {
514
537
  const { data } = await gatewayNetwork<SubmitTransactionResponse, SubmitTransactionRequest>({
515
538
  method: "POST",
516
539
  url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/transaction/submit`,
@@ -524,5 +547,5 @@ export async function submitPreApprovalTransaction(
524
547
  isApproved: true,
525
548
  submissionId: data.submission_id,
526
549
  updateId: data.update_id,
527
- };
550
+ } satisfies PreApprovalResult;
528
551
  }
@@ -9,26 +9,26 @@ import type {
9
9
  TransactionStatusCommon,
10
10
  TransactionStatusCommonRaw,
11
11
  } from "@ledgerhq/types-live";
12
+ import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
12
13
  import type {
13
14
  CantonOnboardProgress,
14
15
  CantonOnboardResult,
15
- CantonPreApprovalProgress,
16
- CantonPreApprovalResult,
16
+ CantonAuthorizeProgress,
17
+ CantonAuthorizeResult,
17
18
  } from "./onboard";
18
- import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
19
19
 
20
20
  export interface CantonCurrencyBridge extends CurrencyBridge {
21
21
  onboardAccount: (
22
22
  currency: CryptoCurrency,
23
23
  deviceId: string,
24
- derivationPath: string,
24
+ creatableAccount: Account,
25
25
  ) => Observable<CantonOnboardProgress | CantonOnboardResult>;
26
26
  authorizePreapproval: (
27
27
  currency: CryptoCurrency,
28
28
  deviceId: string,
29
- derivationPath: string,
29
+ creatableAccount: Account,
30
30
  partyId: string,
31
- ) => Observable<CantonPreApprovalProgress | CantonPreApprovalResult>;
31
+ ) => Observable<CantonAuthorizeProgress | CantonAuthorizeResult>;
32
32
  }
33
33
 
34
34
  export type NetworkInfo = {
@@ -60,16 +60,5 @@ export type TransactionRaw = TransactionCommonRaw & {
60
60
  export type TransactionStatus = TransactionStatusCommon;
61
61
  export type TransactionStatusRaw = TransactionStatusCommonRaw;
62
62
 
63
- export type CantonResources = {
64
- partyId: string;
65
- };
66
- export type CantonResourcesRaw = {
67
- partyId: string;
68
- };
69
-
70
- export type CantonAccount = Account & {
71
- cantonResources?: CantonResources;
72
- };
73
- export type CantonAccountRaw = AccountRaw & {
74
- cantonResources: CantonResourcesRaw;
75
- };
63
+ export type CantonAccount = Account;
64
+ export type CantonAccountRaw = AccountRaw;
@@ -9,7 +9,7 @@ export enum OnboardStatus {
9
9
  ERROR,
10
10
  }
11
11
 
12
- export enum PreApprovalStatus {
12
+ export enum AuthorizeStatus {
13
13
  INIT,
14
14
  PREPARE,
15
15
  SIGN,
@@ -24,14 +24,14 @@ export type CantonOnboardProgress = {
24
24
 
25
25
  export type CantonOnboardResult = {
26
26
  partyId: string;
27
- account: Partial<Account>;
27
+ account: Account;
28
28
  };
29
29
 
30
- export type CantonPreApprovalProgress = {
31
- status: PreApprovalStatus;
30
+ export type CantonAuthorizeProgress = {
31
+ status: AuthorizeStatus;
32
32
  };
33
33
 
34
- export type CantonPreApprovalResult = {
34
+ export type CantonAuthorizeResult = {
35
35
  isApproved: boolean;
36
36
  };
37
37
 
@@ -1,4 +0,0 @@
1
- import type { Account, AccountRaw } from "@ledgerhq/types-live";
2
- export declare function assignToAccountRaw(account: Account, accountRaw: AccountRaw): void;
3
- export declare function assignFromAccountRaw(accountRaw: AccountRaw, account: Account): void;
4
- //# sourceMappingURL=serialization.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/bridge/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAqBhE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAMjF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAMnF"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assignToAccountRaw = assignToAccountRaw;
4
- exports.assignFromAccountRaw = assignFromAccountRaw;
5
- function toResourcesRaw(r) {
6
- const { partyId } = r;
7
- return {
8
- partyId,
9
- };
10
- }
11
- function fromResourcesRaw(r) {
12
- const { partyId } = r;
13
- return {
14
- partyId,
15
- };
16
- }
17
- function assignToAccountRaw(account, accountRaw) {
18
- const cantonAccount = account;
19
- const cantonAccountRaw = accountRaw;
20
- if (cantonAccount.cantonResources) {
21
- cantonAccountRaw.cantonResources = toResourcesRaw(cantonAccount.cantonResources);
22
- }
23
- }
24
- function assignFromAccountRaw(accountRaw, account) {
25
- const cantonResourcesRaw = accountRaw.cantonResources;
26
- const cantonAccount = account;
27
- if (cantonResourcesRaw) {
28
- cantonAccount.cantonResources = fromResourcesRaw(cantonResourcesRaw);
29
- }
30
- }
31
- //# sourceMappingURL=serialization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../src/bridge/serialization.ts"],"names":[],"mappings":";;AAqBA,gDAMC;AAED,oDAMC;AA3BD,SAAS,cAAc,CAAC,CAAkB;IACxC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AACD,SAAS,gBAAgB,CAAC,CAAqB;IAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAgB,EAAE,UAAsB;IACzE,MAAM,aAAa,GAAG,OAAwB,CAAC;IAC/C,MAAM,gBAAgB,GAAG,UAA8B,CAAC;IACxD,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;QAClC,gBAAgB,CAAC,eAAe,GAAG,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAC,UAAsB,EAAE,OAAgB;IAC3E,MAAM,kBAAkB,GAAI,UAA+B,CAAC,eAAe,CAAC;IAC5E,MAAM,aAAa,GAAG,OAAwB,CAAC;IAC/C,IAAI,kBAAkB,EAAE,CAAC;QACvB,aAAa,CAAC,eAAe,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Account, AccountRaw } from "@ledgerhq/types-live";
2
- export declare function assignToAccountRaw(account: Account, accountRaw: AccountRaw): void;
3
- export declare function assignFromAccountRaw(accountRaw: AccountRaw, account: Account): void;
4
- //# sourceMappingURL=serialization.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/bridge/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAqBhE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAMjF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAMnF"}
@@ -1,27 +0,0 @@
1
- function toResourcesRaw(r) {
2
- const { partyId } = r;
3
- return {
4
- partyId,
5
- };
6
- }
7
- function fromResourcesRaw(r) {
8
- const { partyId } = r;
9
- return {
10
- partyId,
11
- };
12
- }
13
- export function assignToAccountRaw(account, accountRaw) {
14
- const cantonAccount = account;
15
- const cantonAccountRaw = accountRaw;
16
- if (cantonAccount.cantonResources) {
17
- cantonAccountRaw.cantonResources = toResourcesRaw(cantonAccount.cantonResources);
18
- }
19
- }
20
- export function assignFromAccountRaw(accountRaw, account) {
21
- const cantonResourcesRaw = accountRaw.cantonResources;
22
- const cantonAccount = account;
23
- if (cantonResourcesRaw) {
24
- cantonAccount.cantonResources = fromResourcesRaw(cantonResourcesRaw);
25
- }
26
- }
27
- //# sourceMappingURL=serialization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../src/bridge/serialization.ts"],"names":[],"mappings":"AAQA,SAAS,cAAc,CAAC,CAAkB;IACxC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AACD,SAAS,gBAAgB,CAAC,CAAqB;IAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACtB,OAAO;QACL,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,UAAsB;IACzE,MAAM,aAAa,GAAG,OAAwB,CAAC;IAC/C,MAAM,gBAAgB,GAAG,UAA8B,CAAC;IACxD,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;QAClC,gBAAgB,CAAC,eAAe,GAAG,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,UAAsB,EAAE,OAAgB;IAC3E,MAAM,kBAAkB,GAAI,UAA+B,CAAC,eAAe,CAAC;IAC5E,MAAM,aAAa,GAAG,OAAwB,CAAC;IAC/C,IAAI,kBAAkB,EAAE,CAAC;QACvB,aAAa,CAAC,eAAe,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
@@ -1,36 +0,0 @@
1
- import type { Account, AccountRaw } from "@ledgerhq/types-live";
2
- import type {
3
- CantonAccount,
4
- CantonAccountRaw,
5
- CantonResources,
6
- CantonResourcesRaw,
7
- } from "../types";
8
-
9
- function toResourcesRaw(r: CantonResources): CantonResourcesRaw {
10
- const { partyId } = r;
11
- return {
12
- partyId,
13
- };
14
- }
15
- function fromResourcesRaw(r: CantonResourcesRaw): CantonResources {
16
- const { partyId } = r;
17
- return {
18
- partyId,
19
- };
20
- }
21
-
22
- export function assignToAccountRaw(account: Account, accountRaw: AccountRaw): void {
23
- const cantonAccount = account as CantonAccount;
24
- const cantonAccountRaw = accountRaw as CantonAccountRaw;
25
- if (cantonAccount.cantonResources) {
26
- cantonAccountRaw.cantonResources = toResourcesRaw(cantonAccount.cantonResources);
27
- }
28
- }
29
-
30
- export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account): void {
31
- const cantonResourcesRaw = (accountRaw as CantonAccountRaw).cantonResources;
32
- const cantonAccount = account as CantonAccount;
33
- if (cantonResourcesRaw) {
34
- cantonAccount.cantonResources = fromResourcesRaw(cantonResourcesRaw);
35
- }
36
- }