@ledgerhq/coin-hedera 1.16.0-nightly.20251219024040 → 1.16.0-nightly.20251223024125
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/CHANGELOG.md +14 -10
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +26 -0
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/synchronisation.js +1 -1
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/bridge/utils.d.ts.map +1 -1
- package/lib/bridge/utils.js +4 -2
- package/lib/bridge/utils.js.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +2 -1
- package/lib/constants.js.map +1 -1
- package/lib/errors.d.ts +3 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +2 -1
- package/lib/errors.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +4 -2
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/utils.d.ts +4 -4
- package/lib/logic/utils.d.ts.map +1 -1
- package/lib/logic/utils.js +6 -6
- package/lib/logic/utils.js.map +1 -1
- package/lib/network/thirdweb.js +1 -1
- package/lib/network/thirdweb.js.map +1 -1
- package/lib/test/fixtures/mirror.fixture.d.ts.map +1 -1
- package/lib/test/fixtures/mirror.fixture.js +1 -0
- package/lib/test/fixtures/mirror.fixture.js.map +1 -1
- package/lib/types/mirror.d.ts +1 -0
- package/lib/types/mirror.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +28 -2
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/synchronisation.js +1 -1
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/bridge/utils.d.ts.map +1 -1
- package/lib-es/bridge/utils.js +4 -2
- package/lib-es/bridge/utils.js.map +1 -1
- package/lib-es/constants.d.ts +1 -0
- package/lib-es/constants.d.ts.map +1 -1
- package/lib-es/constants.js +1 -0
- package/lib-es/constants.js.map +1 -1
- package/lib-es/errors.d.ts +3 -0
- package/lib-es/errors.d.ts.map +1 -1
- package/lib-es/errors.js +1 -0
- package/lib-es/errors.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +4 -2
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/utils.d.ts +4 -4
- package/lib-es/logic/utils.d.ts.map +1 -1
- package/lib-es/logic/utils.js +6 -6
- package/lib-es/logic/utils.js.map +1 -1
- package/lib-es/network/thirdweb.js +1 -1
- package/lib-es/network/thirdweb.js.map +1 -1
- package/lib-es/test/fixtures/mirror.fixture.d.ts.map +1 -1
- package/lib-es/test/fixtures/mirror.fixture.js +1 -0
- package/lib-es/test/fixtures/mirror.fixture.js.map +1 -1
- package/lib-es/types/mirror.d.ts +1 -0
- package/lib-es/types/mirror.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/bridge/getTransactionStatus.test.ts +74 -2
- package/src/bridge/getTransactionStatus.ts +39 -1
- package/src/bridge/synchronisation.ts +1 -1
- package/src/bridge/utils.integration.test.ts +1 -2
- package/src/bridge/utils.test.ts +1 -1
- package/src/bridge/utils.ts +4 -2
- package/src/constants.ts +2 -0
- package/src/errors.ts +1 -0
- package/src/logic/estimateFees.test.ts +8 -2
- package/src/logic/estimateFees.ts +4 -2
- package/src/logic/utils.test.ts +19 -5
- package/src/logic/utils.ts +7 -6
- package/src/network/thirdweb.test.ts +8 -0
- package/src/network/thirdweb.ts +1 -1
- package/src/test/fixtures/mirror.fixture.ts +1 -0
- package/src/types/mirror.ts +1 -0
|
@@ -29,7 +29,7 @@ async function fetchERC20Transactions(contractAddress, options) {
|
|
|
29
29
|
}
|
|
30
30
|
async function getERC20TransactionsForAccount({ address, contractAddresses, transactionFetcher = fetchERC20Transactions, since, }) {
|
|
31
31
|
const allTransactions = [];
|
|
32
|
-
const evmAddress = toEVMAddress(address);
|
|
32
|
+
const evmAddress = await toEVMAddress(address);
|
|
33
33
|
if (contractAddresses.length === 0) {
|
|
34
34
|
return allTransactions;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdweb.js","sourceRoot":"","sources":["../../src/network/thirdweb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C,MAAM,OAAO,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElD,KAAK,UAAU,sBAAsB,CACnC,eAAuB,EACvB,OAAqB;IAErB,MAAM,YAAY,GAAgC,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,YAAY,GAAG,IAAI,CAAC;IAExB,OAAO,YAAY,EAAE,CAAC;QACpB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAuC;YACnE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,OAAO,iBAAiB,uBAAuB,IAAI,eAAe,WAAW,MAAM,CAAC,QAAQ,EAAE,EAAE;SACzG,CAAC,CAAC;QACH,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACpD,YAAY,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QAEtC,6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MAAM,oBAAoB,GAAiB;YACzC,GAAG,UAAU;YACb,YAAY,EAAE,GAAG,CAAC,UAA2B,CAAC,CAAC,QAAQ,EAAE;SAC1D,CAAC;QAEF,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC;QACrF,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;QAEpF,eAAe,CAAC,IAAI,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,2DAA2D;AAC3D,uEAAuE;AACvE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,sBAAsB;IACtB,8BAA8B;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,oBAAoB,eAAgB,QAAQ,iBAAiB,CAAC,KAAG,iBAW7E,CAAC;AAEF,eAAO,MAAM,sBAAsB,eACrB,QAAQ,mBAAmB,CAAC,KACvC,
|
|
1
|
+
{"version":3,"file":"mirror.fixture.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,oBAAoB,eAAgB,QAAQ,iBAAiB,CAAC,KAAG,iBAW7E,CAAC;AAEF,eAAO,MAAM,sBAAsB,eACrB,QAAQ,mBAAmB,CAAC,KACvC,mBAcF,CAAC;AAEF,eAAO,MAAM,wBAAwB,YAC1B,MAAM,UACP,MAAM,KACb,wBAGD,CAAC;AAEH,eAAO,MAAM,yBAAyB,YAC3B,MAAM,UACP,MAAM,WACL,MAAM,KACd,yBAID,CAAC"}
|
|
@@ -13,6 +13,7 @@ export const getMockedMirrorToken = (overrides) => {
|
|
|
13
13
|
export const getMockedMirrorAccount = (overrides) => {
|
|
14
14
|
return {
|
|
15
15
|
account: "0.0.12345",
|
|
16
|
+
evm_address: "0x0000000000000000000000000000000000012345",
|
|
16
17
|
balance: {
|
|
17
18
|
balance: 1000,
|
|
18
19
|
timestamp: "1764932745.835883000",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirror.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAsC,EAAqB,EAAE;IAChG,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,iBAAiB,EAAE,KAAK;QACxB,qBAAqB,EAAE,KAAK;QAC5B,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,gBAAgB;QAC/B,UAAU,EAAE,gBAAgB;QAC5B,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,SAAwC,EACnB,EAAE;IACvB,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE;YACP,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,sBAAsB;YACjC,MAAM,EAAE,EAAE;SACX;QACD,gCAAgC,EAAE,CAAC,CAAC;QACpC,cAAc,EAAE,CAAC;QACjB,cAAc,EAAE,IAAI;QACpB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,OAAe,EACf,MAAc,EACY,EAAE,CAAC,CAAC;IAC9B,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,OAAe,EACf,MAAc,EACd,OAAe,EACY,EAAE,CAAC,CAAC;IAC/B,QAAQ,EAAE,OAAO;IACjB,OAAO;IACP,MAAM;CACP,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"mirror.fixture.js","sourceRoot":"","sources":["../../../src/test/fixtures/mirror.fixture.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAAsC,EAAqB,EAAE;IAChG,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,iBAAiB,EAAE,KAAK;QACxB,qBAAqB,EAAE,KAAK;QAC5B,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,gBAAgB;QAC/B,UAAU,EAAE,gBAAgB;QAC5B,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,SAAwC,EACnB,EAAE;IACvB,OAAO;QACL,OAAO,EAAE,WAAW;QACpB,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE;YACP,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,sBAAsB;YACjC,MAAM,EAAE,EAAE;SACX;QACD,gCAAgC,EAAE,CAAC,CAAC;QACpC,cAAc,EAAE,CAAC;QACjB,cAAc,EAAE,IAAI;QACpB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,OAAe,EACf,MAAc,EACY,EAAE,CAAC,CAAC;IAC9B,OAAO;IACP,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,OAAe,EACf,MAAc,EACd,OAAe,EACY,EAAE,CAAC,CAAC;IAC/B,QAAQ,EAAE,OAAO;IACjB,OAAO;IACP,MAAM;CACP,CAAC,CAAC"}
|
package/lib-es/types/mirror.d.ts
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
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-hedera",
|
|
3
|
-
"version": "1.16.0-nightly.
|
|
3
|
+
"version": "1.16.0-nightly.20251223024125",
|
|
4
4
|
"description": "Ledger Hedera Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
"lodash": "^4.17.21",
|
|
83
83
|
"rxjs": "7.8.2",
|
|
84
84
|
"viem": "^2.27.0",
|
|
85
|
-
"@ledgerhq/coin-framework": "^6.11.0-nightly.
|
|
86
|
-
"@ledgerhq/cryptoassets": "^13.35.0-nightly.
|
|
87
|
-
"@ledgerhq/devices": "8.8.0-nightly.
|
|
88
|
-
"@ledgerhq/errors": "^6.28.0-nightly.
|
|
89
|
-
"@ledgerhq/live-countervalues": "^0.10.3-nightly.
|
|
90
|
-
"@ledgerhq/live-env": "^2.23.0-nightly.
|
|
91
|
-
"@ledgerhq/live-network": "^2.1.4-nightly.
|
|
85
|
+
"@ledgerhq/coin-framework": "^6.11.0-nightly.20251223024125",
|
|
86
|
+
"@ledgerhq/cryptoassets": "^13.35.0-nightly.20251223024125",
|
|
87
|
+
"@ledgerhq/devices": "8.8.0-nightly.20251223024125",
|
|
88
|
+
"@ledgerhq/errors": "^6.28.0-nightly.20251223024125",
|
|
89
|
+
"@ledgerhq/live-countervalues": "^0.10.3-nightly.20251223024125",
|
|
90
|
+
"@ledgerhq/live-env": "^2.23.0-nightly.20251223024125",
|
|
91
|
+
"@ledgerhq/live-network": "^2.1.4-nightly.20251223024125",
|
|
92
92
|
"@ledgerhq/logs": "^6.13.0",
|
|
93
|
-
"@ledgerhq/types-live": "^6.91.0-nightly.
|
|
93
|
+
"@ledgerhq/types-live": "^6.91.0-nightly.20251223024125"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/invariant": "^2.2.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"jest": "^29.7.0",
|
|
101
101
|
"ts-jest": "^29.1.1",
|
|
102
102
|
"@ledgerhq/disable-network-setup": "^0.1.0",
|
|
103
|
-
"@ledgerhq/types-cryptoassets": "^7.31.0-nightly.
|
|
103
|
+
"@ledgerhq/types-cryptoassets": "^7.31.0-nightly.20251223024125"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
106
106
|
"clean": "rimraf lib lib-es",
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
ClaimRewardsFeesWarning,
|
|
8
8
|
RecipientRequired,
|
|
9
9
|
} from "@ledgerhq/errors";
|
|
10
|
-
import
|
|
10
|
+
import * as accountHelpers from "@ledgerhq/coin-framework/account";
|
|
11
|
+
import { HEDERA_TRANSACTION_MODES, MEMO_CHARACTER_LIMIT } from "../constants";
|
|
11
12
|
import {
|
|
12
13
|
HederaInsufficientFundsForAssociation,
|
|
13
14
|
HederaInvalidStakingNodeIdError,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
HederaRecipientTokenAssociationRequired,
|
|
18
19
|
HederaRecipientTokenAssociationUnverified,
|
|
19
20
|
HederaRedundantStakingNodeIdError,
|
|
21
|
+
HederaMemoIsTooLong,
|
|
20
22
|
} from "../errors";
|
|
21
23
|
import { getTransactionStatus } from "./getTransactionStatus";
|
|
22
24
|
import * as estimateFees from "../logic/estimateFees";
|
|
@@ -29,7 +31,7 @@ import {
|
|
|
29
31
|
getMockedHTSTokenCurrency,
|
|
30
32
|
} from "../test/fixtures/currency.fixture";
|
|
31
33
|
import { getMockedTransaction } from "../test/fixtures/transaction.fixture";
|
|
32
|
-
import type { EstimateFeesResult, HederaPreloadData } from "../types";
|
|
34
|
+
import type { EstimateFeesResult, HederaPreloadData, Transaction } from "../types";
|
|
33
35
|
|
|
34
36
|
describe("getTransactionStatus", () => {
|
|
35
37
|
const mockedEstimatedFee: EstimateFeesResult = { tinybars: new BigNumber(1) };
|
|
@@ -40,6 +42,7 @@ describe("getTransactionStatus", () => {
|
|
|
40
42
|
|
|
41
43
|
beforeEach(() => {
|
|
42
44
|
jest.clearAllMocks();
|
|
45
|
+
jest.restoreAllMocks();
|
|
43
46
|
|
|
44
47
|
jest.spyOn(estimateFees, "estimateFees").mockResolvedValueOnce(mockedEstimatedFee);
|
|
45
48
|
jest.spyOn(logicUtils, "getCurrencyToUSDRate").mockResolvedValueOnce(mockedUsdRate);
|
|
@@ -135,6 +138,75 @@ describe("getTransactionStatus", () => {
|
|
|
135
138
|
expect(result.warnings).toEqual({});
|
|
136
139
|
});
|
|
137
140
|
|
|
141
|
+
it.each([
|
|
142
|
+
["undefined", undefined],
|
|
143
|
+
["empty", ""],
|
|
144
|
+
["short", "aaaaa"],
|
|
145
|
+
["exact limit", "a".repeat(MEMO_CHARACTER_LIMIT)],
|
|
146
|
+
])("allows %s memo", async (_description, memo) => {
|
|
147
|
+
const mockedAccount = getMockedAccount();
|
|
148
|
+
const mockedTransaction = getMockedTransaction({ memo });
|
|
149
|
+
|
|
150
|
+
const result = await getTransactionStatus(mockedAccount, mockedTransaction);
|
|
151
|
+
|
|
152
|
+
expect(result.errors.memo).toBeUndefined();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it.each([
|
|
156
|
+
{
|
|
157
|
+
mode: HEDERA_TRANSACTION_MODES.Delegate,
|
|
158
|
+
description: "delegate",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
mode: HEDERA_TRANSACTION_MODES.Undelegate,
|
|
162
|
+
description: "undelegate",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
mode: HEDERA_TRANSACTION_MODES.Redelegate,
|
|
166
|
+
description: "redelegate",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
mode: HEDERA_TRANSACTION_MODES.ClaimRewards,
|
|
170
|
+
description: "claim rewards",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
mode: HEDERA_TRANSACTION_MODES.Send,
|
|
174
|
+
description: "send native",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
mode: HEDERA_TRANSACTION_MODES.Send,
|
|
178
|
+
description: "send hts token",
|
|
179
|
+
subAccount: getMockedTokenAccount(getMockedHTSTokenCurrency(), { id: "hts-id" }),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
mode: HEDERA_TRANSACTION_MODES.Send,
|
|
183
|
+
description: "send erc20 token",
|
|
184
|
+
subAccount: getMockedTokenAccount(getMockedERC20TokenCurrency(), { id: "erc20-id" }),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
mode: HEDERA_TRANSACTION_MODES.TokenAssociate,
|
|
188
|
+
description: "token associate",
|
|
189
|
+
properties: { token: getMockedHTSTokenCurrency() },
|
|
190
|
+
},
|
|
191
|
+
])("adds error for too long memo - $description", async ({ mode, subAccount, properties }) => {
|
|
192
|
+
const tooLongMemo = "a".repeat(MEMO_CHARACTER_LIMIT + 1);
|
|
193
|
+
const mockedAccount = getMockedAccount();
|
|
194
|
+
const mockedTransaction = getMockedTransaction({
|
|
195
|
+
mode,
|
|
196
|
+
memo: tooLongMemo,
|
|
197
|
+
...(subAccount && { subAccountId: subAccount.id }),
|
|
198
|
+
...(properties && { properties }),
|
|
199
|
+
} as Transaction);
|
|
200
|
+
|
|
201
|
+
jest.spyOn(accountHelpers, "findSubAccountById").mockImplementation(() => {
|
|
202
|
+
return subAccount;
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const result = await getTransactionStatus(mockedAccount, mockedTransaction);
|
|
206
|
+
|
|
207
|
+
expect(result.errors.memo).toBeInstanceOf(HederaMemoIsTooLong);
|
|
208
|
+
});
|
|
209
|
+
|
|
138
210
|
it("adds error for invalid recipient address", async () => {
|
|
139
211
|
const mockedAccount = getMockedAccount();
|
|
140
212
|
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
import type { Account, AccountBridge, TokenAccount } from "@ledgerhq/types-live";
|
|
11
11
|
import { findSubAccountById } from "@ledgerhq/coin-framework/account";
|
|
12
12
|
import { getEnv } from "@ledgerhq/live-env";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
HEDERA_OPERATION_TYPES,
|
|
15
|
+
HEDERA_TRANSACTION_MODES,
|
|
16
|
+
MEMO_CHARACTER_LIMIT,
|
|
17
|
+
} from "../constants";
|
|
14
18
|
import {
|
|
15
19
|
HederaInsufficientFundsForAssociation,
|
|
16
20
|
HederaRecipientTokenAssociationRequired,
|
|
@@ -19,6 +23,7 @@ import {
|
|
|
19
23
|
HederaInvalidStakingNodeIdError,
|
|
20
24
|
HederaRedundantStakingNodeIdError,
|
|
21
25
|
HederaNoStakingRewardsError,
|
|
26
|
+
HederaMemoIsTooLong,
|
|
22
27
|
} from "../errors";
|
|
23
28
|
import { estimateFees } from "../logic/estimateFees";
|
|
24
29
|
import {
|
|
@@ -61,6 +66,14 @@ function validateRecipient(account: Account, recipient: string): Error | null {
|
|
|
61
66
|
return null;
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
function validateMemo(memo: string | undefined): Error | null {
|
|
70
|
+
if (memo && memo.length > MEMO_CHARACTER_LIMIT) {
|
|
71
|
+
return new HederaMemoIsTooLong(undefined, { maxLength: MEMO_CHARACTER_LIMIT });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
async function handleTokenAssociateTransaction(
|
|
65
78
|
account: Account,
|
|
66
79
|
transaction: TransactionTokenAssociate,
|
|
@@ -79,6 +92,11 @@ async function handleTokenAssociateTransaction(
|
|
|
79
92
|
const amount = BigNumber(0);
|
|
80
93
|
const totalSpent = amount.plus(estimatedFees.tinybars);
|
|
81
94
|
const isAssociationFlow = isTokenAssociationRequired(account, transaction.properties.token);
|
|
95
|
+
const memoError = validateMemo(transaction.memo);
|
|
96
|
+
|
|
97
|
+
if (memoError) {
|
|
98
|
+
errors.memo = memoError;
|
|
99
|
+
}
|
|
82
100
|
|
|
83
101
|
if (isAssociationFlow) {
|
|
84
102
|
const hbarBalance = account.balance.dividedBy(10 ** account.currency.units[0].magnitude);
|
|
@@ -118,11 +136,16 @@ async function handleHTSTokenTransaction(
|
|
|
118
136
|
]);
|
|
119
137
|
|
|
120
138
|
const recipientError = validateRecipient(account, transaction.recipient);
|
|
139
|
+
const memoError = validateMemo(transaction.memo);
|
|
121
140
|
|
|
122
141
|
if (recipientError) {
|
|
123
142
|
errors.recipient = recipientError;
|
|
124
143
|
}
|
|
125
144
|
|
|
145
|
+
if (memoError) {
|
|
146
|
+
errors.memo = memoError;
|
|
147
|
+
}
|
|
148
|
+
|
|
126
149
|
if (!errors.recipient) {
|
|
127
150
|
try {
|
|
128
151
|
const hasRecipientTokenAssociated = await checkAccountTokenAssociationStatus(
|
|
@@ -189,11 +212,16 @@ async function handleERC20TokenTransaction(
|
|
|
189
212
|
]);
|
|
190
213
|
|
|
191
214
|
const recipientError = validateRecipient(account, transaction.recipient);
|
|
215
|
+
const memoError = validateMemo(transaction.memo);
|
|
192
216
|
|
|
193
217
|
if (recipientError) {
|
|
194
218
|
errors.recipient = recipientError;
|
|
195
219
|
}
|
|
196
220
|
|
|
221
|
+
if (memoError) {
|
|
222
|
+
errors.memo = memoError;
|
|
223
|
+
}
|
|
224
|
+
|
|
197
225
|
if (transaction.amount.eq(0)) {
|
|
198
226
|
errors.amount = new AmountRequired();
|
|
199
227
|
}
|
|
@@ -231,11 +259,16 @@ async function handleCoinTransaction(
|
|
|
231
259
|
]);
|
|
232
260
|
|
|
233
261
|
const recipientError = validateRecipient(account, transaction.recipient);
|
|
262
|
+
const memoError = validateMemo(transaction.memo);
|
|
234
263
|
|
|
235
264
|
if (recipientError) {
|
|
236
265
|
errors.recipient = recipientError;
|
|
237
266
|
}
|
|
238
267
|
|
|
268
|
+
if (memoError) {
|
|
269
|
+
errors.memo = memoError;
|
|
270
|
+
}
|
|
271
|
+
|
|
239
272
|
if (transaction.amount.eq(0) && !transaction.useAllAmount) {
|
|
240
273
|
errors.amount = new AmountRequired();
|
|
241
274
|
}
|
|
@@ -265,6 +298,11 @@ async function handleStakingTransaction(account: HederaAccount, transaction: Tra
|
|
|
265
298
|
});
|
|
266
299
|
const amount = BigNumber(0);
|
|
267
300
|
const totalSpent = amount.plus(estimatedFees.tinybars);
|
|
301
|
+
const memoError = validateMemo(transaction.memo);
|
|
302
|
+
|
|
303
|
+
if (memoError) {
|
|
304
|
+
errors.memo = memoError;
|
|
305
|
+
}
|
|
268
306
|
|
|
269
307
|
if (
|
|
270
308
|
transaction.mode === HEDERA_TRANSACTION_MODES.Delegate ||
|
|
@@ -29,7 +29,7 @@ export const getAccountShape: GetAccountShape<HederaAccount> = async (
|
|
|
29
29
|
): Promise<Partial<HederaAccount>> => {
|
|
30
30
|
const { currency, derivationMode, address, initialAccount } = info;
|
|
31
31
|
invariant(address, "hedera: address is expected");
|
|
32
|
-
const evmAddress = toEVMAddress(address);
|
|
32
|
+
const evmAddress = await toEVMAddress(address);
|
|
33
33
|
invariant(evmAddress, "hedera: evm address is missing");
|
|
34
34
|
|
|
35
35
|
const liveAccountId = encodeAccountId({
|
|
@@ -4,7 +4,6 @@ import { setupCalClientStore } from "@ledgerhq/cryptoassets/cal-client/test-help
|
|
|
4
4
|
import { getCryptoAssetsStore } from "@ledgerhq/cryptoassets/state";
|
|
5
5
|
import { HEDERA_OPERATION_TYPES, HEDERA_TRANSACTION_MODES } from "../constants";
|
|
6
6
|
import { estimateFees } from "../logic/estimateFees";
|
|
7
|
-
import { toEVMAddress } from "../logic/utils";
|
|
8
7
|
import { apiClient } from "../network/api";
|
|
9
8
|
import { getMockedAccount, getMockedTokenAccount } from "../test/fixtures/account.fixture";
|
|
10
9
|
import {
|
|
@@ -270,7 +269,7 @@ describe("utils", () => {
|
|
|
270
269
|
|
|
271
270
|
describe("integrateERC20Operations", () => {
|
|
272
271
|
const address = "0.0.12345";
|
|
273
|
-
const evmAddress =
|
|
272
|
+
const evmAddress = "0x0000000000000000000000000000000000003039";
|
|
274
273
|
const ledgerAccountId = `js:2:hedera:${address}:`;
|
|
275
274
|
const tokenCurrency = getTokenCurrencyFromCALByType("erc20");
|
|
276
275
|
|
package/src/bridge/utils.test.ts
CHANGED
|
@@ -254,7 +254,7 @@ describe("bridge utils", () => {
|
|
|
254
254
|
});
|
|
255
255
|
|
|
256
256
|
describe("classifyERC20Operations", () => {
|
|
257
|
-
const evmAddress = "
|
|
257
|
+
const evmAddress = "0x0000000000000000000000000000000000003039";
|
|
258
258
|
const tokenCurrency = getTokenCurrencyFromCALByType("erc20");
|
|
259
259
|
|
|
260
260
|
it("classifies to 'add' when no matching operation exists", () => {
|
package/src/bridge/utils.ts
CHANGED
|
@@ -544,8 +544,10 @@ export const integrateERC20Operations = async ({
|
|
|
544
544
|
newERC20TokenOperations: Operation[];
|
|
545
545
|
}> => {
|
|
546
546
|
const newERC20TokenOperations: Operation[] = [];
|
|
547
|
-
const latestERC20Operations = await
|
|
548
|
-
|
|
547
|
+
const [latestERC20Operations, evmAddress] = await Promise.all([
|
|
548
|
+
getERC20Operations(latestERC20Transactions),
|
|
549
|
+
toEVMAddress(address),
|
|
550
|
+
]);
|
|
549
551
|
|
|
550
552
|
// avoid duplicated CONTRACT_CALL operations if ERC20 operations are already present
|
|
551
553
|
const uniqueOperations = removeDuplicatedContractCallOperations(
|
package/src/constants.ts
CHANGED
package/src/errors.ts
CHANGED
|
@@ -23,3 +23,4 @@ export const HederaInvalidStakingNodeIdError = createCustomErrorClass(
|
|
|
23
23
|
"HederaInvalidStakingNodeIdError",
|
|
24
24
|
);
|
|
25
25
|
export const HederaNoStakingRewardsError = createCustomErrorClass("HederaNoStakingRewardsError");
|
|
26
|
+
export const HederaMemoIsTooLong = createCustomErrorClass("HederaMemoIsTooLong");
|
|
@@ -96,6 +96,11 @@ describe("getEstimatedFees", () => {
|
|
|
96
96
|
const gasPriceTinybars = new BigNumber(900);
|
|
97
97
|
const transferAmount = BigInt(1000000);
|
|
98
98
|
|
|
99
|
+
(apiClient.getAccount as jest.Mock).mockImplementation(address => ({
|
|
100
|
+
address,
|
|
101
|
+
evm_address: "0x0000000000000000000000000000000000012345",
|
|
102
|
+
}));
|
|
103
|
+
|
|
99
104
|
(apiClient.getNetworkFees as jest.Mock).mockResolvedValueOnce({
|
|
100
105
|
fees: [
|
|
101
106
|
{
|
|
@@ -130,11 +135,12 @@ describe("getEstimatedFees", () => {
|
|
|
130
135
|
.multipliedBy(gasPriceTinybars)
|
|
131
136
|
.integerValue(BigNumber.ROUND_CEIL);
|
|
132
137
|
|
|
138
|
+
expect(apiClient.getAccount).toHaveBeenCalledTimes(2);
|
|
133
139
|
expect(apiClient.getNetworkFees).toHaveBeenCalledTimes(1);
|
|
134
140
|
expect(apiClient.estimateContractCallGas).toHaveBeenCalledTimes(1);
|
|
135
141
|
expect(apiClient.estimateContractCallGas).toHaveBeenCalledWith(
|
|
136
|
-
toEVMAddress(senderAddress),
|
|
137
|
-
toEVMAddress(recipientAddress),
|
|
142
|
+
await toEVMAddress(senderAddress),
|
|
143
|
+
await toEVMAddress(recipientAddress),
|
|
138
144
|
mockedTokenCurrencyERC20.contractAddress,
|
|
139
145
|
transferAmount,
|
|
140
146
|
);
|
|
@@ -21,8 +21,10 @@ const estimateContractCallFees = async (
|
|
|
21
21
|
let gas = new BigNumber(0);
|
|
22
22
|
|
|
23
23
|
const tokenEvmAddress = "assetReference" in txIntent.asset ? txIntent.asset.assetReference : null;
|
|
24
|
-
const senderEvmAddress =
|
|
25
|
-
|
|
24
|
+
const [senderEvmAddress, recipientEvmAddress] = await Promise.all([
|
|
25
|
+
toEVMAddress(txIntent.sender),
|
|
26
|
+
toEVMAddress(txIntent.recipient),
|
|
27
|
+
]);
|
|
26
28
|
|
|
27
29
|
if (!tokenEvmAddress || !senderEvmAddress || !recipientEvmAddress) {
|
|
28
30
|
return {
|
package/src/logic/utils.test.ts
CHANGED
|
@@ -610,13 +610,27 @@ describe("logic utils", () => {
|
|
|
610
610
|
});
|
|
611
611
|
|
|
612
612
|
describe("toEVMAddress", () => {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
const mockMirrorAccount = {
|
|
614
|
+
account: "0.0.12345",
|
|
615
|
+
evm_address: "0x0000000000000000000000000000000000003039",
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
it("returns correct EVM address for valid Hedera account ID", async () => {
|
|
619
|
+
(apiClient.getAccount as jest.Mock).mockResolvedValueOnce(mockMirrorAccount);
|
|
620
|
+
|
|
621
|
+
const evmAddress = await toEVMAddress(mockMirrorAccount.account);
|
|
622
|
+
|
|
623
|
+
expect(apiClient.getAccount).toHaveBeenCalledTimes(1);
|
|
624
|
+
expect(apiClient.getAccount).toHaveBeenCalledWith(mockMirrorAccount.account);
|
|
625
|
+
expect(evmAddress).toBe(mockMirrorAccount.evm_address);
|
|
616
626
|
});
|
|
617
627
|
|
|
618
|
-
it("returns null
|
|
619
|
-
|
|
628
|
+
it("returns null when API call fails", async () => {
|
|
629
|
+
(apiClient.getAccount as jest.Mock).mockRejectedValueOnce(new Error("API error"));
|
|
630
|
+
|
|
631
|
+
const evmAddress = await toEVMAddress(mockMirrorAccount.account);
|
|
632
|
+
|
|
633
|
+
expect(apiClient.getAccount).toHaveBeenCalledTimes(1);
|
|
620
634
|
expect(evmAddress).toBeNull();
|
|
621
635
|
});
|
|
622
636
|
});
|
package/src/logic/utils.ts
CHANGED
|
@@ -365,16 +365,17 @@ export const formatTransactionId = (transactionId: TransactionId): string => {
|
|
|
365
365
|
};
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
368
|
+
* Fetches EVM address for given Hedera account ID (e.g. "0.0.1234").
|
|
369
|
+
* It returns null if the fetch fails.
|
|
370
370
|
*
|
|
371
371
|
* @param address - Hedera account ID in the format `shard.realm.num`
|
|
372
|
-
* @returns
|
|
372
|
+
* @returns EVM address (`0x...`) or null if fetch fails
|
|
373
373
|
*/
|
|
374
|
-
export const toEVMAddress = (accountId: string) => {
|
|
374
|
+
export const toEVMAddress = async (accountId: string): Promise<string | null> => {
|
|
375
375
|
try {
|
|
376
|
-
const
|
|
377
|
-
|
|
376
|
+
const account = await apiClient.getAccount(accountId);
|
|
377
|
+
|
|
378
|
+
return account.evm_address;
|
|
378
379
|
} catch {
|
|
379
380
|
return null;
|
|
380
381
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { pad } from "viem";
|
|
2
2
|
import network from "@ledgerhq/live-network";
|
|
3
|
+
import { apiClient } from "./api";
|
|
3
4
|
import { getMockedThirdwebTransaction } from "../test/fixtures/thirdweb.fixture";
|
|
4
5
|
import { getMockResponse } from "../test/fixtures/common.fixture";
|
|
5
6
|
import { thirdwebClient } from "./thirdweb";
|
|
6
7
|
|
|
7
8
|
jest.mock("@ledgerhq/live-network");
|
|
9
|
+
jest.mock("./api");
|
|
10
|
+
|
|
8
11
|
const mockedNetwork = jest.mocked(network);
|
|
9
12
|
|
|
10
13
|
const mockedERC20Transaction = getMockedThirdwebTransaction();
|
|
@@ -130,6 +133,11 @@ describe("fetchERC20Transactions", () => {
|
|
|
130
133
|
describe("getERC20TransactionsForAccount", () => {
|
|
131
134
|
beforeEach(() => {
|
|
132
135
|
jest.clearAllMocks();
|
|
136
|
+
|
|
137
|
+
(apiClient.getAccount as jest.Mock).mockImplementation(address => ({
|
|
138
|
+
address,
|
|
139
|
+
evm_address: "0x0000000000000000000000000000000000012345",
|
|
140
|
+
}));
|
|
133
141
|
});
|
|
134
142
|
|
|
135
143
|
it("should return empty array without balance tokens list", async () => {
|
package/src/network/thirdweb.ts
CHANGED
|
@@ -56,7 +56,7 @@ async function getERC20TransactionsForAccount({
|
|
|
56
56
|
transactionFetcher?: typeof fetchERC20Transactions; // optional dependency injection for testing
|
|
57
57
|
}): Promise<HederaThirdwebTransaction[]> {
|
|
58
58
|
const allTransactions: HederaThirdwebTransaction[] = [];
|
|
59
|
-
const evmAddress = toEVMAddress(address);
|
|
59
|
+
const evmAddress = await toEVMAddress(address);
|
|
60
60
|
|
|
61
61
|
if (contractAddresses.length === 0) {
|
|
62
62
|
return allTransactions;
|