@ledgerhq/coin-framework 2.6.0-nightly.5 → 3.0.0-next.0

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @ledgerhq/coin-framework@2.6.0-nightly.4 build /home/runner/work/ledger-live/ledger-live/libs/coin-framework
2
+ > @ledgerhq/coin-framework@2.6.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-framework
3
3
  > tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # @ledgerhq/coin-framework
2
2
 
3
- ## 2.6.0-nightly.5
3
+ ## 3.0.0-next.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#9835](https://github.com/LedgerHQ/ledger-live/pull/9835) [`8d36e9b`](https://github.com/LedgerHQ/ledger-live/commit/8d36e9b2474a4c600427f357adad04f99a89e13d) Thanks [@francois-guerin-ledger](https://github.com/francois-guerin-ledger)! - feat(coin-framework): return token balances in `getBalance`
4
8
 
5
9
  ### Minor Changes
6
10
 
@@ -8,60 +12,62 @@
8
12
 
9
13
  ### Patch Changes
10
14
 
11
- - Updated dependencies [[`bf3dec3`](https://github.com/LedgerHQ/ledger-live/commit/bf3dec3eb166f80e066f466e0e03291c9a141a81)]:
12
- - @ledgerhq/types-cryptoassets@7.22.0-nightly.0
13
- - @ledgerhq/cryptoassets@13.15.0-nightly.3
14
- - @ledgerhq/types-live@6.66.0-nightly.4
15
+ - Updated dependencies [[`6f61972`](https://github.com/LedgerHQ/ledger-live/commit/6f619728e200270a674ffb13b10375765b55ae4b), [`3f8a531`](https://github.com/LedgerHQ/ledger-live/commit/3f8a53196dfb80d084056e0d896e09869c8ff949), [`b580b04`](https://github.com/LedgerHQ/ledger-live/commit/b580b04e02392a706534c2fceba192ae3b6242ef), [`1e56618`](https://github.com/LedgerHQ/ledger-live/commit/1e56618a3c31e7980074072e0aae9422c145f4b3), [`4c6b682`](https://github.com/LedgerHQ/ledger-live/commit/4c6b682b9929334a7be13212a69f2c6a614f372c), [`bf3dec3`](https://github.com/LedgerHQ/ledger-live/commit/bf3dec3eb166f80e066f466e0e03291c9a141a81)]:
16
+ - @ledgerhq/types-live@6.67.0-next.0
17
+ - @ledgerhq/cryptoassets@13.15.0-next.0
18
+ - @ledgerhq/types-cryptoassets@7.22.0-next.0
15
19
 
16
- ## 2.6.0-nightly.4
20
+ ## 2.6.0
17
21
 
18
- ### Patch Changes
22
+ ### Minor Changes
19
23
 
20
- - Updated dependencies [[`4c6b682`](https://github.com/LedgerHQ/ledger-live/commit/4c6b682b9929334a7be13212a69f2c6a614f372c)]:
21
- - @ledgerhq/types-live@6.66.0-nightly.3
24
+ - [#9736](https://github.com/LedgerHQ/ledger-live/pull/9736) [`44ae74c`](https://github.com/LedgerHQ/ledger-live/commit/44ae74c272ba803bed7c9f4fc3351e3ce8a15531) Thanks [@jprudent](https://github.com/jprudent)! - fix conversion of bignumber to bigint
22
25
 
23
- ## 2.6.0-nightly.3
26
+ - [#9681](https://github.com/LedgerHQ/ledger-live/pull/9681) [`71bb6a9`](https://github.com/LedgerHQ/ledger-live/commit/71bb6a9adb4ac83172be5def5b25d2836380df1d) Thanks [@Moustafa-Koterba](https://github.com/Moustafa-Koterba)! - add & Record<string, unknown> to TransactionIntent on coin-framework to support coin specific logic like memo, tag etc.
24
27
 
25
- ### Patch Changes
28
+ - [#9666](https://github.com/LedgerHQ/ledger-live/pull/9666) [`8ce7b0a`](https://github.com/LedgerHQ/ledger-live/commit/8ce7b0ab2d1d73ef071102f795e7c868c676b1f4) Thanks [@Moustafa-Koterba](https://github.com/Moustafa-Koterba)! - update the following modules for an optional fees parameter on craft transaction functions: coin-stellar, coin-tezos, coin-tron, coin-xrp, coin-framework
26
29
 
27
- - Updated dependencies [[`6f61972`](https://github.com/LedgerHQ/ledger-live/commit/6f619728e200270a674ffb13b10375765b55ae4b)]:
28
- - @ledgerhq/types-live@6.66.0-nightly.2
30
+ - [#9720](https://github.com/LedgerHQ/ledger-live/pull/9720) [`46a9620`](https://github.com/LedgerHQ/ledger-live/commit/46a9620b4ea6343efc28792d3b57bf84ee2a23e8) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - Remove generated formatters file
29
31
 
30
- ## 2.6.0-nightly.2
32
+ - [#9597](https://github.com/LedgerHQ/ledger-live/pull/9597) [`1e7d454`](https://github.com/LedgerHQ/ledger-live/commit/1e7d454d99f1f39880f39a120c59020725d26475) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - isAccountEmpty is now defined in each coin needed a dedicated logic.
31
33
 
32
- ### Minor Changes
34
+ - [#9648](https://github.com/LedgerHQ/ledger-live/pull/9648) [`f1732a7`](https://github.com/LedgerHQ/ledger-live/commit/f1732a795e54f666b67e7686d59926037412caca) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - Remove SubAccount as it is an alias to TokenAccount
33
35
 
34
- - [#9451](https://github.com/LedgerHQ/ledger-live/pull/9451) [`c6cb1bd`](https://github.com/LedgerHQ/ledger-live/commit/c6cb1bd2a0768ccbeeee96342dc8b872a620f3ac) Thanks [@may01](https://github.com/may01)! - Add aptos tokens to cryptoassets
36
+ - [#9690](https://github.com/LedgerHQ/ledger-live/pull/9690) [`d694069`](https://github.com/LedgerHQ/ledger-live/commit/d6940698a49b7a0ed48f84d6e8184d80760cca4f) Thanks [@Justkant](https://github.com/Justkant)! - feat: support Solana NFTs
35
37
 
36
38
  ### Patch Changes
37
39
 
38
- - Updated dependencies [[`3f8a531`](https://github.com/LedgerHQ/ledger-live/commit/3f8a53196dfb80d084056e0d896e09869c8ff949), [`b580b04`](https://github.com/LedgerHQ/ledger-live/commit/b580b04e02392a706534c2fceba192ae3b6242ef), [`c6cb1bd`](https://github.com/LedgerHQ/ledger-live/commit/c6cb1bd2a0768ccbeeee96342dc8b872a620f3ac)]:
39
- - @ledgerhq/types-live@6.66.0-nightly.1
40
- - @ledgerhq/cryptoassets@13.15.0-nightly.2
41
- - @ledgerhq/errors@6.20.0-nightly.0
42
- - @ledgerhq/devices@8.4.5-nightly.0
43
- - @ledgerhq/live-network@2.0.7-nightly.1
40
+ - Updated dependencies [[`46a9620`](https://github.com/LedgerHQ/ledger-live/commit/46a9620b4ea6343efc28792d3b57bf84ee2a23e8), [`f1732a7`](https://github.com/LedgerHQ/ledger-live/commit/f1732a795e54f666b67e7686d59926037412caca), [`32d46cc`](https://github.com/LedgerHQ/ledger-live/commit/32d46cc77debe059ae0bcd848a21065dec7ee091), [`d694069`](https://github.com/LedgerHQ/ledger-live/commit/d6940698a49b7a0ed48f84d6e8184d80760cca4f)]:
41
+ - @ledgerhq/types-live@6.66.0
42
+ - @ledgerhq/live-env@2.8.0
43
+ - @ledgerhq/cryptoassets@13.14.1
44
+ - @ledgerhq/live-network@2.0.7
44
45
 
45
- ## 2.6.0-nightly.1
46
+ ## 2.6.0-next.0
46
47
 
47
- ### Patch Changes
48
+ ### Minor Changes
48
49
 
49
- - Updated dependencies [[`1e56618`](https://github.com/LedgerHQ/ledger-live/commit/1e56618a3c31e7980074072e0aae9422c145f4b3)]:
50
- - @ledgerhq/cryptoassets@13.15.0-nightly.1
50
+ - [#9736](https://github.com/LedgerHQ/ledger-live/pull/9736) [`44ae74c`](https://github.com/LedgerHQ/ledger-live/commit/44ae74c272ba803bed7c9f4fc3351e3ce8a15531) Thanks [@jprudent](https://github.com/jprudent)! - fix conversion of bignumber to bigint
51
51
 
52
- ## 2.6.0-nightly.0
52
+ - [#9681](https://github.com/LedgerHQ/ledger-live/pull/9681) [`71bb6a9`](https://github.com/LedgerHQ/ledger-live/commit/71bb6a9adb4ac83172be5def5b25d2836380df1d) Thanks [@Moustafa-Koterba](https://github.com/Moustafa-Koterba)! - add & Record<string, unknown> to TransactionIntent on coin-framework to support coin specific logic like memo, tag etc.
53
53
 
54
- ### Minor Changes
54
+ - [#9666](https://github.com/LedgerHQ/ledger-live/pull/9666) [`8ce7b0a`](https://github.com/LedgerHQ/ledger-live/commit/8ce7b0ab2d1d73ef071102f795e7c868c676b1f4) Thanks [@Moustafa-Koterba](https://github.com/Moustafa-Koterba)! - update the following modules for an optional fees parameter on craft transaction functions: coin-stellar, coin-tezos, coin-tron, coin-xrp, coin-framework
55
55
 
56
56
  - [#9720](https://github.com/LedgerHQ/ledger-live/pull/9720) [`46a9620`](https://github.com/LedgerHQ/ledger-live/commit/46a9620b4ea6343efc28792d3b57bf84ee2a23e8) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - Remove generated formatters file
57
57
 
58
+ - [#9597](https://github.com/LedgerHQ/ledger-live/pull/9597) [`1e7d454`](https://github.com/LedgerHQ/ledger-live/commit/1e7d454d99f1f39880f39a120c59020725d26475) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - isAccountEmpty is now defined in each coin needed a dedicated logic.
59
+
60
+ - [#9648](https://github.com/LedgerHQ/ledger-live/pull/9648) [`f1732a7`](https://github.com/LedgerHQ/ledger-live/commit/f1732a795e54f666b67e7686d59926037412caca) Thanks [@sprohaszka-ledger](https://github.com/sprohaszka-ledger)! - Remove SubAccount as it is an alias to TokenAccount
61
+
62
+ - [#9690](https://github.com/LedgerHQ/ledger-live/pull/9690) [`d694069`](https://github.com/LedgerHQ/ledger-live/commit/d6940698a49b7a0ed48f84d6e8184d80760cca4f) Thanks [@Justkant](https://github.com/Justkant)! - feat: support Solana NFTs
63
+
58
64
  ### Patch Changes
59
65
 
60
- - Updated dependencies [[`46a9620`](https://github.com/LedgerHQ/ledger-live/commit/46a9620b4ea6343efc28792d3b57bf84ee2a23e8), [`32d46cc`](https://github.com/LedgerHQ/ledger-live/commit/32d46cc77debe059ae0bcd848a21065dec7ee091)]:
61
- - @ledgerhq/types-live@6.66.0-nightly.0
62
- - @ledgerhq/live-env@2.8.0-nightly.0
63
- - @ledgerhq/cryptoassets@13.14.1-nightly.0
64
- - @ledgerhq/live-network@2.0.7-nightly.0
66
+ - Updated dependencies [[`46a9620`](https://github.com/LedgerHQ/ledger-live/commit/46a9620b4ea6343efc28792d3b57bf84ee2a23e8), [`f1732a7`](https://github.com/LedgerHQ/ledger-live/commit/f1732a795e54f666b67e7686d59926037412caca), [`32d46cc`](https://github.com/LedgerHQ/ledger-live/commit/32d46cc77debe059ae0bcd848a21065dec7ee091), [`d694069`](https://github.com/LedgerHQ/ledger-live/commit/d6940698a49b7a0ed48f84d6e8184d80760cca4f)]:
67
+ - @ledgerhq/types-live@6.66.0-next.0
68
+ - @ledgerhq/live-env@2.8.0-next.0
69
+ - @ledgerhq/cryptoassets@13.14.1-next.0
70
+ - @ledgerhq/live-network@2.0.7-next.0
65
71
 
66
72
  ## 2.5.0
67
73
 
@@ -3,13 +3,19 @@ export type BlockInfo = {
3
3
  hash?: string;
4
4
  time?: Date;
5
5
  };
6
- export type Operation<AssetInfo> = {
6
+ type TokenInfoCommon = Record<string, unknown>;
7
+ export type Asset<TokenInfo extends TokenInfoCommon = never> = {
8
+ type: "native";
9
+ } | (TokenInfo extends never ? TokenInfo : {
10
+ type: "token";
11
+ } & TokenInfo);
12
+ export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
7
13
  type: string;
8
14
  operationIndex: number;
9
15
  senders: string[];
10
16
  recipients: string[];
11
17
  value: bigint;
12
- asset?: AssetInfo;
18
+ asset: AssetInfo;
13
19
  details?: Record<string, unknown>;
14
20
  tx: {
15
21
  hash: string;
@@ -24,26 +30,28 @@ export type Transaction = {
24
30
  amount: bigint;
25
31
  fee: bigint;
26
32
  } & Record<string, unknown>;
27
- export type Asset = {
28
- native: bigint;
33
+ export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
34
+ value: bigint;
35
+ asset: AssetInfo;
29
36
  };
30
- export type TransactionIntent<AssetInfo, Extra = Record<string, unknown>> = {
37
+ export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, Extra = Record<string, unknown>> = {
31
38
  type: string;
32
39
  sender: string;
33
40
  recipient: string;
34
41
  amount: bigint;
35
- asset?: AssetInfo;
42
+ asset: AssetInfo;
36
43
  } & Extra;
37
44
  export type Pagination = {
38
45
  minHeight: number;
39
46
  };
40
- export type Api<TokenIdentifier> = {
47
+ export type Api<AssetInfo extends Asset<TokenInfoCommon>> = {
41
48
  broadcast: (tx: string) => Promise<string>;
42
49
  combine: (tx: string, signature: string, pubkey?: string) => string;
43
- estimateFees: (transactionIntent: TransactionIntent<TokenIdentifier>) => Promise<bigint>;
44
- craftTransaction: (transactionIntent: TransactionIntent<TokenIdentifier>, customFees?: bigint) => Promise<string>;
45
- getBalance: (address: string) => Promise<Asset | bigint>;
50
+ estimateFees: (transactionIntent: TransactionIntent<AssetInfo>) => Promise<bigint>;
51
+ craftTransaction: (transactionIntent: TransactionIntent<AssetInfo>, customFees?: bigint) => Promise<string>;
52
+ getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
46
53
  lastBlock: () => Promise<BlockInfo>;
47
- listOperations: (address: string, pagination: Pagination) => Promise<[Operation<TokenIdentifier>[], string]>;
54
+ listOperations: (address: string, pagination: Pagination) => Promise<[Operation<AssetInfo>[], string]>;
48
55
  };
56
+ export {};
49
57
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,SAAS,IAAI;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,OAAO,CAAC,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EAAE,CAChB,iBAAiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,EAC/C,UAAU,CAAC,EAAE,MAAM,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,EAAE,CACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,KACnB,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAAC"}
@@ -3,13 +3,19 @@ export type BlockInfo = {
3
3
  hash?: string;
4
4
  time?: Date;
5
5
  };
6
- export type Operation<AssetInfo> = {
6
+ type TokenInfoCommon = Record<string, unknown>;
7
+ export type Asset<TokenInfo extends TokenInfoCommon = never> = {
8
+ type: "native";
9
+ } | (TokenInfo extends never ? TokenInfo : {
10
+ type: "token";
11
+ } & TokenInfo);
12
+ export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
7
13
  type: string;
8
14
  operationIndex: number;
9
15
  senders: string[];
10
16
  recipients: string[];
11
17
  value: bigint;
12
- asset?: AssetInfo;
18
+ asset: AssetInfo;
13
19
  details?: Record<string, unknown>;
14
20
  tx: {
15
21
  hash: string;
@@ -24,26 +30,28 @@ export type Transaction = {
24
30
  amount: bigint;
25
31
  fee: bigint;
26
32
  } & Record<string, unknown>;
27
- export type Asset = {
28
- native: bigint;
33
+ export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
34
+ value: bigint;
35
+ asset: AssetInfo;
29
36
  };
30
- export type TransactionIntent<AssetInfo, Extra = Record<string, unknown>> = {
37
+ export type TransactionIntent<AssetInfo extends Asset<TokenInfoCommon>, Extra = Record<string, unknown>> = {
31
38
  type: string;
32
39
  sender: string;
33
40
  recipient: string;
34
41
  amount: bigint;
35
- asset?: AssetInfo;
42
+ asset: AssetInfo;
36
43
  } & Extra;
37
44
  export type Pagination = {
38
45
  minHeight: number;
39
46
  };
40
- export type Api<TokenIdentifier> = {
47
+ export type Api<AssetInfo extends Asset<TokenInfoCommon>> = {
41
48
  broadcast: (tx: string) => Promise<string>;
42
49
  combine: (tx: string, signature: string, pubkey?: string) => string;
43
- estimateFees: (transactionIntent: TransactionIntent<TokenIdentifier>) => Promise<bigint>;
44
- craftTransaction: (transactionIntent: TransactionIntent<TokenIdentifier>, customFees?: bigint) => Promise<string>;
45
- getBalance: (address: string) => Promise<Asset | bigint>;
50
+ estimateFees: (transactionIntent: TransactionIntent<AssetInfo>) => Promise<bigint>;
51
+ craftTransaction: (transactionIntent: TransactionIntent<AssetInfo>, customFees?: bigint) => Promise<string>;
52
+ getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
46
53
  lastBlock: () => Promise<BlockInfo>;
47
- listOperations: (address: string, pagination: Pagination) => Promise<[Operation<TokenIdentifier>[], string]>;
54
+ listOperations: (address: string, pagination: Pagination) => Promise<[Operation<AssetInfo>[], string]>;
48
55
  };
56
+ export {};
49
57
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,SAAS,IAAI;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,OAAO,CAAC,EAAE,MAAM,CAA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AiB,EAAE,iBAAiB,CAAC,SAAS,CAAC,EAC/C,UAAU,CAAC,EAAE,MAAM,KAChB,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,EAAE,CACd,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,KACnB,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-framework",
3
- "version": "2.6.0-nightly.5",
3
+ "version": "3.0.0-next.0",
4
4
  "description": "Ledger framework for Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -91,14 +91,14 @@
91
91
  "lodash": "^4.17.21",
92
92
  "prando": "^6.0.1",
93
93
  "rxjs": "^7.8.1",
94
- "@ledgerhq/cryptoassets": "^13.15.0-nightly.3",
95
- "@ledgerhq/devices": "8.4.5-nightly.0",
96
- "@ledgerhq/errors": "^6.20.0-nightly.0",
97
- "@ledgerhq/live-env": "^2.8.0-nightly.0",
98
- "@ledgerhq/live-network": "^2.0.7-nightly.1",
94
+ "@ledgerhq/cryptoassets": "^13.15.0-next.0",
95
+ "@ledgerhq/devices": "8.4.4",
96
+ "@ledgerhq/errors": "^6.19.1",
97
+ "@ledgerhq/live-env": "^2.8.0",
98
+ "@ledgerhq/live-network": "^2.0.7",
99
99
  "@ledgerhq/logs": "^6.12.0",
100
- "@ledgerhq/types-cryptoassets": "^7.22.0-nightly.0",
101
- "@ledgerhq/types-live": "^6.66.0-nightly.4"
100
+ "@ledgerhq/types-cryptoassets": "^7.22.0-next.0",
101
+ "@ledgerhq/types-live": "^6.67.0-next.0"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@types/invariant": "^2.2.2",
@@ -110,8 +110,8 @@
110
110
  "timemachine": "^0.3.2",
111
111
  "ts-jest": "^29.1.1",
112
112
  "jest-sonar": "0.2.16",
113
- "@ledgerhq/hw-transport-node-speculos": "^6.29.5-nightly.0",
114
- "@ledgerhq/hw-transport-node-speculos-http": "^6.29.5-nightly.0"
113
+ "@ledgerhq/hw-transport-node-speculos": "^6.29.4",
114
+ "@ledgerhq/hw-transport-node-speculos-http": "^6.29.4"
115
115
  },
116
116
  "scripts": {
117
117
  "clean": "rm -rf lib lib-es",
package/src/api/types.ts CHANGED
@@ -7,15 +7,20 @@ export type BlockInfo = {
7
7
  time?: Date;
8
8
  };
9
9
 
10
- export type Operation<AssetInfo> = {
10
+ type TokenInfoCommon = Record<string, unknown>;
11
+ // TODO add a `token: string` field to the pagination if we really need to support pagination (which is not the case for now)
12
+ export type Asset<TokenInfo extends TokenInfoCommon = never> =
13
+ | { type: "native" }
14
+ | (TokenInfo extends never ? TokenInfo : { type: "token" } & TokenInfo);
15
+
16
+ export type Operation<AssetInfo extends Asset<TokenInfoCommon>> = {
11
17
  type: string;
12
18
  // This operation corresponds to the index-th event triggered bu the original transaction
13
19
  operationIndex: number;
14
20
  senders: string[];
15
21
  recipients: string[];
16
22
  value: bigint;
17
- // Asset is not defined when dealing with native currency
18
- asset?: AssetInfo;
23
+ asset: AssetInfo;
19
24
  // Field containing dedicated value for each blockchain
20
25
  details?: Record<string, unknown>;
21
26
  tx: {
@@ -36,17 +41,20 @@ export type Transaction = {
36
41
  fee: bigint;
37
42
  } & Record<string, unknown>; // Field containing dedicated value for each blockchain
38
43
 
39
- // TODO add a `token: string` field to the pagination if we really need to support pagination (which is not the case for now)
40
- export type Asset = {
41
- native: bigint;
44
+ export type Balance<AssetInfo extends Asset<TokenInfoCommon>> = {
45
+ value: bigint;
46
+ asset: AssetInfo;
42
47
  };
43
48
 
44
- export type TransactionIntent<AssetInfo, Extra = Record<string, unknown>> = {
49
+ export type TransactionIntent<
50
+ AssetInfo extends Asset<TokenInfoCommon>,
51
+ Extra = Record<string, unknown>,
52
+ > = {
45
53
  type: string;
46
54
  sender: string;
47
55
  recipient: string;
48
56
  amount: bigint;
49
- asset?: AssetInfo;
57
+ asset: AssetInfo;
50
58
  } & Extra;
51
59
 
52
60
  // TODO rename start to minHeight
@@ -56,18 +64,18 @@ export type TransactionIntent<AssetInfo, Extra = Record<string, unknown>> = {
56
64
  // limit is unused for now
57
65
  // see design document at https://ledgerhq.atlassian.net/wiki/spaces/BE/pages/5446205788/coin-modules+lama-adapter+APIs+refinements
58
66
  export type Pagination = { minHeight: number };
59
- export type Api<TokenIdentifier> = {
67
+ export type Api<AssetInfo extends Asset<TokenInfoCommon>> = {
60
68
  broadcast: (tx: string) => Promise<string>;
61
69
  combine: (tx: string, signature: string, pubkey?: string) => string;
62
- estimateFees: (transactionIntent: TransactionIntent<TokenIdentifier>) => Promise<bigint>;
70
+ estimateFees: (transactionIntent: TransactionIntent<AssetInfo>) => Promise<bigint>;
63
71
  craftTransaction: (
64
- transactionIntent: TransactionIntent<TokenIdentifier>,
72
+ transactionIntent: TransactionIntent<AssetInfo>,
65
73
  customFees?: bigint,
66
74
  ) => Promise<string>;
67
- getBalance: (address: string) => Promise<Asset | bigint>;
75
+ getBalance: (address: string) => Promise<Balance<AssetInfo>[]>;
68
76
  lastBlock: () => Promise<BlockInfo>;
69
77
  listOperations: (
70
78
  address: string,
71
79
  pagination: Pagination,
72
- ) => Promise<[Operation<TokenIdentifier>[], string]>;
80
+ ) => Promise<[Operation<AssetInfo>[], string]>;
73
81
  };