@ledgerhq/coin-evm 16.5.3 → 16.6.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/api/index.d.ts +5 -2
  3. package/lib/api/index.d.ts.map +1 -1
  4. package/lib/api/index.js +2 -1
  5. package/lib/api/index.js.map +1 -1
  6. package/lib/errors.d.ts +17 -0
  7. package/lib/errors.d.ts.map +1 -1
  8. package/lib/errors.js +26 -1
  9. package/lib/errors.js.map +1 -1
  10. package/lib/logic/cip64Fees.d.ts +43 -0
  11. package/lib/logic/cip64Fees.d.ts.map +1 -0
  12. package/lib/logic/cip64Fees.js +139 -0
  13. package/lib/logic/cip64Fees.js.map +1 -0
  14. package/lib/logic/feeCollectorOperations.d.ts +2 -2
  15. package/lib/logic/feeCollectorOperations.js +2 -2
  16. package/lib/logic/getBlock.d.ts +2 -2
  17. package/lib/logic/getBlock.d.ts.map +1 -1
  18. package/lib/logic/getBlock.js +99 -19
  19. package/lib/logic/getBlock.js.map +1 -1
  20. package/lib/network/node/rpc.common.d.ts.map +1 -1
  21. package/lib/network/node/rpc.common.js +59 -6
  22. package/lib/network/node/rpc.common.js.map +1 -1
  23. package/lib/network/node/types.d.ts +8 -1
  24. package/lib/network/node/types.d.ts.map +1 -1
  25. package/lib/network/node/types.js.map +1 -1
  26. package/lib/network/node/withNodeSources.d.ts.map +1 -1
  27. package/lib/network/node/withNodeSources.js +2 -0
  28. package/lib/network/node/withNodeSources.js.map +1 -1
  29. package/lib-es/api/index.d.ts +5 -2
  30. package/lib-es/api/index.d.ts.map +1 -1
  31. package/lib-es/api/index.js +2 -1
  32. package/lib-es/api/index.js.map +1 -1
  33. package/lib-es/errors.d.ts +17 -0
  34. package/lib-es/errors.d.ts.map +1 -1
  35. package/lib-es/errors.js +21 -0
  36. package/lib-es/errors.js.map +1 -1
  37. package/lib-es/logic/cip64Fees.d.ts +43 -0
  38. package/lib-es/logic/cip64Fees.d.ts.map +1 -0
  39. package/lib-es/logic/cip64Fees.js +134 -0
  40. package/lib-es/logic/cip64Fees.js.map +1 -0
  41. package/lib-es/logic/feeCollectorOperations.d.ts +2 -2
  42. package/lib-es/logic/feeCollectorOperations.js +2 -2
  43. package/lib-es/logic/getBlock.d.ts +2 -2
  44. package/lib-es/logic/getBlock.d.ts.map +1 -1
  45. package/lib-es/logic/getBlock.js +99 -19
  46. package/lib-es/logic/getBlock.js.map +1 -1
  47. package/lib-es/network/node/rpc.common.d.ts.map +1 -1
  48. package/lib-es/network/node/rpc.common.js +59 -6
  49. package/lib-es/network/node/rpc.common.js.map +1 -1
  50. package/lib-es/network/node/types.d.ts +8 -1
  51. package/lib-es/network/node/types.d.ts.map +1 -1
  52. package/lib-es/network/node/types.js.map +1 -1
  53. package/lib-es/network/node/withNodeSources.d.ts.map +1 -1
  54. package/lib-es/network/node/withNodeSources.js +2 -0
  55. package/lib-es/network/node/withNodeSources.js.map +1 -1
  56. package/package.json +2 -2
  57. package/src/api/index.ts +4 -1
  58. package/src/api/tests/index.celo.integ.test.ts +93 -0
  59. package/src/api/tests/index.flare.integ.test.ts +2 -1
  60. package/src/api/tests/index.test.ts +9 -0
  61. package/src/errors.ts +24 -0
  62. package/src/logic/cip64Fees.ts +193 -0
  63. package/src/logic/feeCollectorOperations.ts +2 -2
  64. package/src/logic/getBlock.ts +170 -30
  65. package/src/logic/tests/cip64Fees.test.ts +277 -0
  66. package/src/logic/tests/getBlock.test.ts +249 -2
  67. package/src/network/node/rpc.common.ts +74 -7
  68. package/src/network/node/types.ts +8 -1
  69. package/src/network/node/withNodeSources.ts +3 -0
  70. package/src/network/tests/node/rpc.test.ts +197 -0
  71. package/src/network/tests/node/withNodeSources.test.ts +18 -0
@@ -1 +1 @@
1
- {"version":3,"file":"withNodeSources.d.ts","sourceRoot":"","sources":["../../../src/network/node/withNodeSources.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAoB,OAAO,EAAkB,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAA;AAMpE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAiDjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAc5F"}
1
+ {"version":3,"file":"withNodeSources.d.ts","sourceRoot":"","sources":["../../../src/network/node/withNodeSources.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAoB,OAAO,EAAkB,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAA;AAMpE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAoDjF;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAc5F"}
@@ -44,6 +44,8 @@ export function createFailoverNodeApi(sources, logger) {
44
44
  // Optional methods: wired when at least one source implements them; undefined sources skipped
45
45
  if (sources.some((api) => api.getBlockReceipts))
46
46
  base.getBlockReceipts = (h) => tryInOrder('getBlockReceipts', (api) => api.getBlockReceipts?.(h));
47
+ if (sources.some((api) => api.getFeeCurrencies))
48
+ base.getFeeCurrencies = (h) => tryInOrder('getFeeCurrencies', (api) => api.getFeeCurrencies?.(h));
47
49
  if (sources.some((api) => api.traceBlockErigon))
48
50
  base.traceBlockErigon = (h) => tryInOrder('traceBlockErigon', (api) => api.traceBlockErigon?.(h));
49
51
  if (sources.some((api) => api.traceBlockGeth))
@@ -1 +1 @@
1
- {"version":3,"file":"withNodeSources.js","sourceRoot":"","sources":["../../../src/network/node/withNodeSources.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,sCAAsC;AAKtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAE5D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAkB,EAAE,MAAc;IACtE,KAAK,UAAU,UAAU,CACvB,MAAc,EACd,MAAgD;QAEhD,IAAI,UAAmB,CAAA;QACvB,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,SAAS;gBAAE,SAAQ;YAC7B,IAAI,CAAC;gBACH,OAAO,MAAM,CAAC,CAAA;YAChB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,UAAU,KAAK,SAAS;oBAAE,UAAU,GAAG,CAAC,CAAA;gBAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,MAAM,8BAA8B,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;YACnF,CAAC;QACH,CAAC;QACD,MAAM,UAAU,IAAI,IAAI,KAAK,CAAC,OAAO,MAAM,sBAAsB,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,IAAI,GAAY;QACpB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,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AAC,CAAC,EAA6B,EAAE,CACrD,UAAU,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAClE,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,GAAY,EAAE,MAAqB,EAAE,MAAc;IACjF,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,IAAI,oBAAoB,CAAA;IAE1D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,OAAO,GAAG,CAAA;IAC7D,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,GAAG,CAAA;IAE/D,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAA;IACvC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,IAAI,mBAAmB,CAAA;IAEtE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACxC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,0BAA0B,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,CAAC,CAC3F,CAAA;IAED,OAAO,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AAClD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-evm",
3
- "version": "16.5.3",
3
+ "version": "16.6.0",
4
4
  "description": "Ledger EVM Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -118,7 +118,7 @@
118
118
  "license": "Apache-2.0",
119
119
  "dependencies": {
120
120
  "@ethersproject/shims": "^5.7.0",
121
- "@ledgerhq/coin-module-framework": "^11.3.0",
121
+ "@ledgerhq/coin-module-framework": "^11.4.0",
122
122
  "axios": "1.20.0",
123
123
  "bignumber.js": "^9.1.2",
124
124
  "eip55": "^2.1.1",
package/src/api/index.ts CHANGED
@@ -14,6 +14,7 @@ import type {
14
14
  CraftedTransaction,
15
15
  Cursor,
16
16
  FeeEstimation,
17
+ GetBlockOptions,
17
18
  ListOperationsOptions,
18
19
  MemoNotSupported,
19
20
  Operation,
@@ -112,7 +113,8 @@ export function createApi() {
112
113
  address: string,
113
114
  options: ListOperationsOptions
114
115
  ): Promise<Page<Operation<MemoNotSupported>>> => listOperations(context, address, options),
115
- getBlock: (context: EvmContext, height: number): Promise<Block> => getBlock(context, height),
116
+ getBlock: (context: EvmContext, height: number, options?: GetBlockOptions): Promise<Block> =>
117
+ getBlock(context, height, options),
116
118
  getBlockInfo: (context: EvmContext, height: number): Promise<BlockInfo> =>
117
119
  getBlockInfo(context, height),
118
120
  getValidators: async (
@@ -136,6 +138,7 @@ export function createApi() {
136
138
  _context: EvmContext,
137
139
  intent: TransactionIntent<MemoNotSupported, BufferTxData>
138
140
  ): BufferTxData => craftTransactionData(intent),
141
+ readOptions: { getBlock: ['feesAsset'] },
139
142
  } satisfies CoinModuleImpl<EvmConfigInfo, MemoNotSupported, BufferTxData>
140
143
  }
141
144
 
@@ -0,0 +1,93 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { EvmConfigInfo } from '../../config'
5
+ import type { BlockOperation } from '@ledgerhq/coin-module-framework/api/index'
6
+ import { CHAIN_ID, internalTxSourcesFromList } from '../../config'
7
+ import { createMockEvmContext } from '../../fixtures/context.fixtures'
8
+ import { createApi } from '../index'
9
+
10
+ const USDT = '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e'
11
+ const USDC = '0xcebA9300f2b948710d2653dD7B07f33A8B32118C'
12
+ const CUSD = '0x765DE816845861e75A25fCA122bb6898B8B1282a'
13
+ const CEUR = '0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73'
14
+ const USDT_SENDER = '0xfb4863FC2FE52A8131696e4a3a86676cff40A806'
15
+
16
+ function usdtTransfer(from: string, to: string, amount: bigint): BlockOperation[] {
17
+ const asset = { type: 'erc20' as const, assetReference: USDT }
18
+ return [
19
+ { type: 'transfer', address: from, peer: to, asset, amount: -amount },
20
+ { type: 'transfer', address: to, peer: from, asset, amount },
21
+ ]
22
+ }
23
+
24
+ describe('EVM Celo Network', () => {
25
+ const config: EvmConfigInfo = {
26
+ status: { type: 'active' },
27
+ chainId: CHAIN_ID.CELO,
28
+ name: 'Celo',
29
+ unit: { name: 'CELO', code: 'CELO', magnitude: 18 },
30
+ node: { type: 'external', uri: 'https://forno.celo.org' },
31
+ explorer: { type: 'none' },
32
+ getBlockInternalTxsSources: internalTxSourcesFromList(['empty']),
33
+ }
34
+ const module = createApi()
35
+
36
+ describe('getBlock with the fee asset', () => {
37
+ it.each([
38
+ {
39
+ fee: 'USD₮ (adapter)',
40
+ height: 80494727,
41
+ hash: '0x45e41cf20fca9b079f8b23510bb9637d14df647cb6d25d85157924cd27df09d7',
42
+ payer: '0x5362C723476b46a1e65D54E667C00e46b46F6f12',
43
+ fees: 3176n,
44
+ feesAsset: USDT,
45
+ operations: usdtTransfer(USDT_SENDER, '0x5362C723476b46a1e65D54E667C00e46b46F6f12', 7000n),
46
+ },
47
+ {
48
+ fee: 'USDC (adapter)',
49
+ height: 80502070,
50
+ hash: '0xf43732d1ca9d43dd6515708669e6083010672aed8a61de4c8d07164c7e3d400d',
51
+ payer: '0x3EE17b4D2eC4E33339eE34f6F2a16429c4C67738',
52
+ fees: 4072n,
53
+ feesAsset: USDC,
54
+ operations: usdtTransfer(USDT_SENDER, '0x3EE17b4D2eC4E33339eE34f6F2a16429c4C67738', 9000n),
55
+ },
56
+ {
57
+ fee: 'cUSD',
58
+ height: 82654841,
59
+ hash: '0xa92de9a2b85e285d2bf1c1317386e012034ddfbbd84739e5b5f46fe6c252e748',
60
+ payer: '0xfb6f89fd218A62E39c9bb4D3bb0bc029ec0C6F73',
61
+ fees: 2255358224402010n,
62
+ feesAsset: CUSD,
63
+ operations: usdtTransfer(USDT_SENDER, '0xfb6f89fd218A62E39c9bb4D3bb0bc029ec0C6F73', 5800n),
64
+ },
65
+ {
66
+ fee: 'cEUR (fee-only transaction)',
67
+ height: 82654843,
68
+ hash: '0x6b455f0193606be12273669e67edebf8765de56e4472d7aef86b51157a889797',
69
+ payer: '0x45F81020b469c9312068B91c0C977e7021840229',
70
+ fees: 2623801530470940n,
71
+ feesAsset: CEUR,
72
+ operations: [],
73
+ },
74
+ ])(
75
+ 'reports a fee paid in $fee in token units, without its fee logs',
76
+ async ({ height, hash, payer, fees, feesAsset, operations }) => {
77
+ const block = await module.getBlock(createMockEvmContext(config), height, {
78
+ feesAsset: true,
79
+ })
80
+
81
+ const tx = block.transactions.find((transaction) => transaction.hash === hash)
82
+ expect(tx).toMatchObject({
83
+ fees,
84
+ feesAsset: { type: 'erc20', assetReference: feesAsset },
85
+ operations,
86
+ })
87
+ // The node may serve a block in a shape ethers cannot format, and the raw fallback keeps
88
+ // the node's lower-case addresses
89
+ expect(tx?.feesPayer?.toLowerCase()).toBe(payer.toLowerCase())
90
+ }
91
+ )
92
+ })
93
+ })
@@ -21,7 +21,8 @@ describe('Flare (external node)', () => {
21
21
  module = createApi()
22
22
  })
23
23
 
24
- it('internal txs can be retrieved from node', async () => {
24
+ // TODO: Re-enable once the Flare backend supports trace_block or debug_traceBlockByNumber.
25
+ it.skip('internal txs can be retrieved from node', async () => {
25
26
  // the support for trace on https://rpc.au.cc/flare (Geth as of 2026-03-27) is very ephemeral,
26
27
  // - test on the tip of the chain without guarantees there is actually internal txs
27
28
  // - test that the call is not failing (getBlock should not reject)
@@ -1,6 +1,7 @@
1
1
  // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { withDefaults } from '@ledgerhq/coin-module-framework/api/index'
4
5
  import { mockEvmContext } from '../../fixtures/context.fixtures'
5
6
  import { getValidatorsPage } from '../../staking/validators'
6
7
  import { createApi, parseCallParams } from '../index'
@@ -29,6 +30,7 @@ describe.each([
29
30
  validateAddress: expect.any(Function),
30
31
  validateIntent: expect.any(Function),
31
32
  craftTransactionData: expect.any(Function),
33
+ readOptions: { getBlock: ['feesAsset'] },
32
34
  },
33
35
  ],
34
36
  [
@@ -50,6 +52,7 @@ describe.each([
50
52
  validateAddress: expect.any(Function),
51
53
  validateIntent: expect.any(Function),
52
54
  craftTransactionData: expect.any(Function),
55
+ readOptions: { getBlock: ['feesAsset'] },
53
56
  },
54
57
  ],
55
58
  ])('coin-framework methods %s', (_s, _config, methods) => {
@@ -63,6 +66,12 @@ describe.each([
63
66
  expect(impl).not.toHaveProperty(method)
64
67
  }
65
68
  })
69
+
70
+ it('honours the fee asset read option on getBlock only', () => {
71
+ const api = withDefaults(createApi())
72
+ expect(api.supportsReadOption('getBlock', 'feesAsset')).toBe(true)
73
+ expect(api.supportsReadOption('listOperations', 'feesAsset')).toBe(false)
74
+ })
66
75
  })
67
76
 
68
77
  describe('parseCallParams', () => {
package/src/errors.ts CHANGED
@@ -121,6 +121,30 @@ export class MalformedNodeResponse extends Error {
121
121
  }
122
122
  }
123
123
 
124
+ /** The fee of a transaction paid in a token cannot be read. Each cause has its own subclass. */
125
+ export class UnreadableFeeError extends Error {
126
+ override name = 'UnreadableFeeError'
127
+ constructor(message?: string, fields?: Record<string, unknown>) {
128
+ super(message || 'UnreadableFeeError')
129
+ if (fields) Object.assign(this, fields)
130
+ }
131
+ }
132
+
133
+ /** The transaction pays its fee in a currency whose fee logs are not supported. */
134
+ export class UnsupportedFeeCurrencyError extends UnreadableFeeError {
135
+ override name = 'UnsupportedFeeCurrencyError'
136
+ }
137
+
138
+ /** The fee logs of the transaction do not have the shape of its fee currency. */
139
+ export class UnexpectedFeeLogsError extends UnreadableFeeError {
140
+ override name = 'UnexpectedFeeLogsError'
141
+ }
142
+
143
+ /** The node does not report the fee currency of the transaction. */
144
+ export class FeeCurrencyUnavailableError extends UnreadableFeeError {
145
+ override name = 'FeeCurrencyUnavailableError'
146
+ }
147
+
124
148
  /**
125
149
  * Internal-tx source should be skipped (not propagated): not configured, structurally
126
150
  * unsupported, best-effort runtime failure (e.g. explorer), or all sources exhausted
@@ -0,0 +1,193 @@
1
+ // SPDX-FileCopyrightText: © 2026 LEDGER SAS
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { ERC20Transfer, NodeApi } from '../network/node/types'
5
+ import type { AssetInfo } from '@ledgerhq/coin-module-framework/api/index'
6
+ import {
7
+ FeeCurrencyUnavailableError,
8
+ UnexpectedFeeLogsError,
9
+ UnsupportedFeeCurrencyError,
10
+ } from '../errors'
11
+
12
+ /** EIP-2718 type of a Celo CIP-64 transaction, which can pay its fee in a token. */
13
+ export const CIP64_TX_TYPE = 0x7b
14
+
15
+ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
16
+
17
+ /**
18
+ * How a fee currency moves the fee, as token transfers around the transaction's own logs. Celo's
19
+ * op-geth debits the fee before the transaction runs and credits it after, so a receipt is
20
+ * `[debit][transaction][credits]`, also when the transaction fails. The credits are, in an order
21
+ * that depends on the fee currency, the refund to the payer, the tip with the L1 fee, and the
22
+ * base fee.
23
+ *
24
+ * - `holder`: the payer sends the fee to a holder address, which sends each credit.
25
+ * - `burnRemint`: the payer burns the fee, gets it minted back, then sends the tip and base fee.
26
+ * - `burnMint`: the payer burns the fee, and each credit is minted.
27
+ */
28
+ type FeePattern = 'holder' | 'burnRemint' | 'burnMint'
29
+
30
+ /** Credits of every supported fee currency: refund, tip and base fee, each emitted also when 0. */
31
+ const CREDIT_COUNT = 3
32
+
33
+ /**
34
+ * Fee currencies whose fee logs were checked on mainnet receipts, by lower-case fee currency
35
+ * address, with the lower-case token they move. Any other fee currency is rejected rather than
36
+ * guessed.
37
+ */
38
+ const CELO_FEE_CURRENCIES: ReadonlyMap<string, { token: string; pattern: FeePattern }> = new Map([
39
+ // USD₮ through its adapter
40
+ [
41
+ '0x0e2a3e05bc9a16f5292a6170456a710cb89c6f72',
42
+ { token: '0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e', pattern: 'holder' },
43
+ ],
44
+ // USDC through its adapter
45
+ [
46
+ '0x2f25deb3848c207fc8e0c34035b3ba7fc157602b',
47
+ { token: '0xceba9300f2b948710d2653dd7b07f33a8b32118c', pattern: 'burnRemint' },
48
+ ],
49
+ // cUSD
50
+ [
51
+ '0x765de816845861e75a25fca122bb6898b8b1282a',
52
+ { token: '0x765de816845861e75a25fca122bb6898b8b1282a', pattern: 'burnMint' },
53
+ ],
54
+ // cEUR
55
+ [
56
+ '0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73',
57
+ { token: '0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73', pattern: 'burnMint' },
58
+ ],
59
+ ])
60
+
61
+ /** The fee of a token-paid transaction, and the transfers of the transaction itself. */
62
+ export type TokenFee = {
63
+ fees: bigint
64
+ feesAsset: AssetInfo
65
+ transfers: ERC20Transfer[]
66
+ }
67
+
68
+ const same = (a: string, b: string): boolean => a.toLowerCase() === b.toLowerCase()
69
+
70
+ function matchesPattern(
71
+ pattern: FeePattern,
72
+ payer: string,
73
+ debit: ERC20Transfer,
74
+ credits: readonly ERC20Transfer[]
75
+ ): boolean {
76
+ if (!same(debit.from, payer)) return false
77
+ switch (pattern) {
78
+ case 'holder':
79
+ return credits.every((credit) => same(credit.from, debit.to))
80
+ case 'burnRemint': {
81
+ const [remint, ...payments] = credits
82
+ return (
83
+ same(debit.to, ZERO_ADDRESS) &&
84
+ remint !== undefined &&
85
+ same(remint.from, ZERO_ADDRESS) &&
86
+ same(remint.to, payer) &&
87
+ remint.value === debit.value &&
88
+ payments.every((payment) => same(payment.from, payer))
89
+ )
90
+ }
91
+ case 'burnMint':
92
+ return (
93
+ same(debit.to, ZERO_ADDRESS) && credits.every((credit) => same(credit.from, ZERO_ADDRESS))
94
+ )
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Splits the token transfers of a CIP-64 transaction into its fee and its own transfers.
100
+ *
101
+ * The fee logs are found by position: the first transfer is the debit and the last
102
+ * {@link CREDIT_COUNT} are the credits, each checked against the pattern of the fee currency.
103
+ * Matching on position, not on recipients, keeps a transfer of the transaction to the fee
104
+ * recipients. The fee is what the payer sent minus what it got back, in the token's own units:
105
+ * a value converted from the adapter's 18 decimals would not be the amount debited.
106
+ *
107
+ * @param feeCurrency `feeCurrency` of the transaction
108
+ * @param payer sender of the transaction
109
+ * @param transfers the token transfers of the receipt, in log order
110
+ * @throws UnsupportedFeeCurrencyError when the fee currency is not supported
111
+ * @throws UnexpectedFeeLogsError when the fee logs do not match the fee currency
112
+ */
113
+ export function splitTokenFee(
114
+ feeCurrency: string,
115
+ payer: string,
116
+ transfers: readonly ERC20Transfer[]
117
+ ): TokenFee {
118
+ const currency = CELO_FEE_CURRENCIES.get(feeCurrency.toLowerCase())
119
+ if (currency === undefined) {
120
+ throw new UnsupportedFeeCurrencyError(`Unsupported Celo fee currency ${feeCurrency}`, {
121
+ feeCurrency,
122
+ })
123
+ }
124
+
125
+ const creditStart = transfers.length - CREDIT_COUNT
126
+ const [debit] = transfers
127
+ const credits = transfers.slice(creditStart)
128
+ if (
129
+ debit === undefined ||
130
+ creditStart < 1 ||
131
+ ![debit, ...credits].every((transfer) => same(transfer.asset.assetReference, currency.token)) ||
132
+ !matchesPattern(currency.pattern, payer, debit, credits)
133
+ ) {
134
+ throw new UnexpectedFeeLogsError(`Unexpected fee logs for Celo fee currency ${feeCurrency}`, {
135
+ feeCurrency,
136
+ })
137
+ }
138
+
139
+ let fees = 0n
140
+ for (const transfer of [debit, ...credits]) {
141
+ const value = BigInt(transfer.value)
142
+ if (same(transfer.from, payer)) fees += value
143
+ if (same(transfer.to, payer)) fees -= value
144
+ }
145
+ if (fees < 0n) {
146
+ throw new UnexpectedFeeLogsError(`Negative fee for Celo fee currency ${feeCurrency}`, {
147
+ feeCurrency,
148
+ })
149
+ }
150
+
151
+ return {
152
+ fees,
153
+ feesAsset: { type: 'erc20', assetReference: debit.asset.assetReference },
154
+ transfers: transfers.slice(1, creditStart),
155
+ }
156
+ }
157
+
158
+ /** Reads the token fee of a transaction, or `undefined` when it pays in the native coin. */
159
+ export type ReadTokenFee = (tx: {
160
+ hash: string
161
+ from: string
162
+ type?: number | undefined
163
+ erc20Transfers: readonly ERC20Transfer[]
164
+ }) => Promise<TokenFee | undefined>
165
+
166
+ /**
167
+ * Reads the token fee of the CIP-64 transactions of a Celo block. The fee currencies of the block
168
+ * are fetched once, at the first transaction that is or may be CIP-64: a receipt without a type
169
+ * does not prove the transaction pays in the native coin.
170
+ *
171
+ * @param nodeApi node of the network
172
+ * @param blockHeight height of the block
173
+ */
174
+ export function createCeloTokenFeeReader(nodeApi: NodeApi, blockHeight: number): ReadTokenFee {
175
+ let feeCurrencies: Promise<Map<string, string | null>> | undefined
176
+ return async ({ hash, from, type, erc20Transfers }) => {
177
+ if (type !== undefined && type !== CIP64_TX_TYPE) return undefined
178
+ if (nodeApi.getFeeCurrencies === undefined) {
179
+ throw new FeeCurrencyUnavailableError(
180
+ 'The node cannot report the fee currency of a transaction',
181
+ { hash }
182
+ )
183
+ }
184
+ feeCurrencies ??= nodeApi.getFeeCurrencies(blockHeight)
185
+ const feeCurrency = (await feeCurrencies).get(hash.toLowerCase())
186
+ if (feeCurrency === undefined) {
187
+ throw new FeeCurrencyUnavailableError(`The node block has no transaction ${hash}`, {
188
+ hash,
189
+ })
190
+ }
191
+ return feeCurrency === null ? undefined : splitTokenFee(feeCurrency, from, erc20Transfers)
192
+ }
193
+ }
@@ -193,8 +193,8 @@ export async function findTransactionsPaidByOthers(
193
193
  * instead, as ADR-016 allows.
194
194
  *
195
195
  * The fee also moves as base-token transfers (zkSync `0x800A`), which stay as token operations,
196
- * as `getBlock` keeps them (BACK-11036). ADR-068 (proposed) would remove fee movements in every
197
- * asset, behind an opt-in option; this function does not follow it.
196
+ * as `getBlock` keeps them without its `feesAsset` option (BACK-11036). ADR-068 removes fee
197
+ * movements in every asset behind that option; this function does not follow it yet.
198
198
  *
199
199
  * @param operations operations of the account, as listOperations returns them
200
200
  * @param address the account