@ledgerhq/coin-cardano 0.13.0-nightly.7 → 0.13.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +23 -66
- package/lib/address.unit.test.d.ts +2 -0
- package/lib/address.unit.test.d.ts.map +1 -0
- package/lib/address.unit.test.js +21 -0
- package/lib/address.unit.test.js.map +1 -0
- package/lib/bridge.integration.test.d.ts +4 -0
- package/lib/bridge.integration.test.d.ts.map +1 -0
- package/lib/bridge.integration.test.js +120 -0
- package/lib/bridge.integration.test.js.map +1 -0
- package/lib/buildTransaction.test.d.ts +2 -0
- package/lib/buildTransaction.test.d.ts.map +1 -0
- package/lib/buildTransaction.test.js +172 -0
- package/lib/buildTransaction.test.js.map +1 -0
- package/lib/getTransactionStatus/getTransactionStatus.test.d.ts +2 -0
- package/lib/getTransactionStatus/getTransactionStatus.test.d.ts.map +1 -0
- package/lib/getTransactionStatus/getTransactionStatus.test.js +149 -0
- package/lib/getTransactionStatus/getTransactionStatus.test.js.map +1 -0
- package/lib/getTransactionStatus/handler.test.d.ts +2 -0
- package/lib/getTransactionStatus/handler.test.d.ts.map +1 -0
- package/lib/getTransactionStatus/handler.test.js +51 -0
- package/lib/getTransactionStatus/handler.test.js.map +1 -0
- package/lib/logic.unit.test.d.ts +2 -0
- package/lib/logic.unit.test.d.ts.map +1 -0
- package/lib/logic.unit.test.js +55 -0
- package/lib/logic.unit.test.js.map +1 -0
- package/lib/synchronisation.unit.test.d.ts +2 -0
- package/lib/synchronisation.unit.test.d.ts.map +1 -0
- package/lib/synchronisation.unit.test.js +150 -0
- package/lib/synchronisation.unit.test.js.map +1 -0
- package/lib-es/address.unit.test.d.ts +2 -0
- package/lib-es/address.unit.test.d.ts.map +1 -0
- package/lib-es/address.unit.test.js +19 -0
- package/lib-es/address.unit.test.js.map +1 -0
- package/lib-es/bridge.integration.test.d.ts +4 -0
- package/lib-es/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/bridge.integration.test.js +114 -0
- package/lib-es/bridge.integration.test.js.map +1 -0
- package/lib-es/buildTransaction.test.d.ts +2 -0
- package/lib-es/buildTransaction.test.d.ts.map +1 -0
- package/lib-es/buildTransaction.test.js +167 -0
- package/lib-es/buildTransaction.test.js.map +1 -0
- package/lib-es/getTransactionStatus/getTransactionStatus.test.d.ts +2 -0
- package/lib-es/getTransactionStatus/getTransactionStatus.test.d.ts.map +1 -0
- package/lib-es/getTransactionStatus/getTransactionStatus.test.js +121 -0
- package/lib-es/getTransactionStatus/getTransactionStatus.test.js.map +1 -0
- package/lib-es/getTransactionStatus/handler.test.d.ts +2 -0
- package/lib-es/getTransactionStatus/handler.test.d.ts.map +1 -0
- package/lib-es/getTransactionStatus/handler.test.js +26 -0
- package/lib-es/getTransactionStatus/handler.test.js.map +1 -0
- package/lib-es/logic.unit.test.d.ts +2 -0
- package/lib-es/logic.unit.test.d.ts.map +1 -0
- package/lib-es/logic.unit.test.js +50 -0
- package/lib-es/logic.unit.test.js.map +1 -0
- package/lib-es/synchronisation.unit.test.d.ts +2 -0
- package/lib-es/synchronisation.unit.test.d.ts.map +1 -0
- package/lib-es/synchronisation.unit.test.js +145 -0
- package/lib-es/synchronisation.unit.test.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { getCardanoTestnetAccount } from "./fixtures/accounts";
|
|
3
|
+
import { buildTransaction } from "./buildTransaction";
|
|
4
|
+
import { types as TyphonTypes } from "@stricahq/typhonjs";
|
|
5
|
+
import { getProtocolParams } from "./fixtures/protocolParams";
|
|
6
|
+
describe("buildTransaction", () => {
|
|
7
|
+
const txPayload = {
|
|
8
|
+
family: "cardano",
|
|
9
|
+
recipient: "addr_test1qz7jw975stagnvs00wsjny6y6gpazn86yvwcm2vy02j3up7mt68vuzvz4nzgs00x0shrgywvy674v6r2zcs8fxvvq27qfjq8np",
|
|
10
|
+
amount: new BigNumber(2e6),
|
|
11
|
+
mode: "send",
|
|
12
|
+
poolId: undefined,
|
|
13
|
+
protocolParams: getProtocolParams(),
|
|
14
|
+
};
|
|
15
|
+
describe("certificates", () => {
|
|
16
|
+
it("should not add abstain when there is no delegation", async () => {
|
|
17
|
+
// account with no delegation
|
|
18
|
+
const account = getCardanoTestnetAccount({ delegation: undefined });
|
|
19
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
20
|
+
const certificates = transaction.getCertificates();
|
|
21
|
+
expect(certificates).toEqual([]);
|
|
22
|
+
});
|
|
23
|
+
it("should not add abstain when there is no rewards", async () => {
|
|
24
|
+
const account = getCardanoTestnetAccount({
|
|
25
|
+
delegation: {
|
|
26
|
+
dRepHex: undefined,
|
|
27
|
+
rewards: new BigNumber(0), // no rewards
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
31
|
+
const certificates = transaction.getCertificates();
|
|
32
|
+
expect(certificates).toEqual([]);
|
|
33
|
+
});
|
|
34
|
+
it("should not add abstain vote when dRepHex is present", async () => {
|
|
35
|
+
const account = getCardanoTestnetAccount({
|
|
36
|
+
delegation: {
|
|
37
|
+
dRepHex: "drepHex", // drepHex present
|
|
38
|
+
rewards: new BigNumber(10e6),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
42
|
+
const certificates = transaction.getCertificates();
|
|
43
|
+
expect(certificates).toEqual([]);
|
|
44
|
+
});
|
|
45
|
+
it("should add abstain when drepHex is absent and rewards is available", async () => {
|
|
46
|
+
const account = getCardanoTestnetAccount({
|
|
47
|
+
delegation: {
|
|
48
|
+
dRepHex: undefined, // drepHex absent
|
|
49
|
+
rewards: new BigNumber(10e6), // rewards available
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
53
|
+
const certificates = transaction.getCertificates();
|
|
54
|
+
expect(certificates.some(c => c.type === TyphonTypes.CertificateType.VOTE_DELEGATION &&
|
|
55
|
+
c.cert.dRep.type === TyphonTypes.DRepType.ABSTAIN)).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("withdrawals", () => {
|
|
59
|
+
it("should not add withdrawal when there is no delegation", async () => {
|
|
60
|
+
const account = getCardanoTestnetAccount({ delegation: undefined });
|
|
61
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
62
|
+
const withdrawals = transaction.getWithdrawals();
|
|
63
|
+
expect(withdrawals.length).toBe(0);
|
|
64
|
+
});
|
|
65
|
+
it("should not add withdrawal if no rewards", async () => {
|
|
66
|
+
const account = getCardanoTestnetAccount({
|
|
67
|
+
delegation: {
|
|
68
|
+
rewards: new BigNumber(0), // no rewards
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
72
|
+
const withdrawals = transaction.getWithdrawals();
|
|
73
|
+
expect(withdrawals.length).toBe(0);
|
|
74
|
+
});
|
|
75
|
+
it("should not add withdrawal when dRepHex is absent", async () => {
|
|
76
|
+
const account = getCardanoTestnetAccount({
|
|
77
|
+
delegation: {
|
|
78
|
+
dRepHex: undefined, // drepHex absent
|
|
79
|
+
rewards: new BigNumber(10e6), // rewards available
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
83
|
+
const withdrawals = transaction.getWithdrawals();
|
|
84
|
+
expect(withdrawals.length).toBe(0);
|
|
85
|
+
});
|
|
86
|
+
it("should add withdrawal when dRepHex and rewards both are available", async () => {
|
|
87
|
+
const account = getCardanoTestnetAccount({
|
|
88
|
+
delegation: {
|
|
89
|
+
dRepHex: "drepHex", // drepHex present
|
|
90
|
+
rewards: new BigNumber(10e6), // rewards available
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
const transaction = await buildTransaction(account, txPayload);
|
|
94
|
+
const withdrawals = transaction.getWithdrawals();
|
|
95
|
+
expect(withdrawals.length).toBe(1);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe("undelegate transaction", () => {
|
|
99
|
+
it("should build a undelegate transaction with correct deposit", async () => {
|
|
100
|
+
const account = getCardanoTestnetAccount({
|
|
101
|
+
delegation: {
|
|
102
|
+
status: true,
|
|
103
|
+
deposit: (3e6).toString(),
|
|
104
|
+
rewards: new BigNumber(0),
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
const txPayloadUndelegate = {
|
|
108
|
+
family: "cardano",
|
|
109
|
+
recipient: "",
|
|
110
|
+
amount: new BigNumber(0),
|
|
111
|
+
mode: "undelegate",
|
|
112
|
+
poolId: undefined,
|
|
113
|
+
protocolParams: getProtocolParams(),
|
|
114
|
+
};
|
|
115
|
+
const transaction = await buildTransaction(account, txPayloadUndelegate);
|
|
116
|
+
const deregisterCertificate = transaction
|
|
117
|
+
.getCertificates()
|
|
118
|
+
.find(c => c.type === TyphonTypes.CertificateType.STAKE_KEY_DE_REGISTRATION);
|
|
119
|
+
expect(deregisterCertificate).toBeDefined();
|
|
120
|
+
expect(deregisterCertificate.cert.deposit.toString()).toBe(account.cardanoResources.delegation?.deposit);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe("delegate transaction", () => {
|
|
124
|
+
it("should build delegate transaction with stake key registration", async () => {
|
|
125
|
+
const account = getCardanoTestnetAccount({
|
|
126
|
+
delegation: undefined, // stake key not registered
|
|
127
|
+
});
|
|
128
|
+
const txPayloadDelegate = {
|
|
129
|
+
family: "cardano",
|
|
130
|
+
recipient: "",
|
|
131
|
+
amount: new BigNumber(0),
|
|
132
|
+
mode: "delegate",
|
|
133
|
+
poolId: "7df262feae9201d1b2e32d4c825ca91b29fbafb2b8e556f6efb7f549",
|
|
134
|
+
protocolParams: getProtocolParams(),
|
|
135
|
+
};
|
|
136
|
+
const transaction = await buildTransaction(account, txPayloadDelegate);
|
|
137
|
+
const registerCertificate = transaction
|
|
138
|
+
.getCertificates()
|
|
139
|
+
.find(c => c.type === TyphonTypes.CertificateType.STAKE_KEY_REGISTRATION);
|
|
140
|
+
expect(registerCertificate).toBeDefined();
|
|
141
|
+
expect(registerCertificate.cert.deposit.toString()).toBe(transaction.protocolParams.stakeKeyDeposit.toString());
|
|
142
|
+
});
|
|
143
|
+
it("should build delegate transaction without stake key registration", async () => {
|
|
144
|
+
const account = getCardanoTestnetAccount({
|
|
145
|
+
delegation: {
|
|
146
|
+
status: true, // stake key already registered
|
|
147
|
+
deposit: (2e6).toString(),
|
|
148
|
+
rewards: new BigNumber(0),
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
const txPayloadDelegate = {
|
|
152
|
+
family: "cardano",
|
|
153
|
+
recipient: "",
|
|
154
|
+
amount: new BigNumber(0),
|
|
155
|
+
mode: "delegate",
|
|
156
|
+
poolId: "7df262feae9201d1b2e32d4c825ca91b29fbafb2b8e556f6efb7f549",
|
|
157
|
+
protocolParams: getProtocolParams(),
|
|
158
|
+
};
|
|
159
|
+
const transaction = await buildTransaction(account, txPayloadDelegate);
|
|
160
|
+
const registerCertificate = transaction
|
|
161
|
+
.getCertificates()
|
|
162
|
+
.find(c => c.type === TyphonTypes.CertificateType.STAKE_KEY_REGISTRATION);
|
|
163
|
+
expect(registerCertificate).toBeUndefined();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=buildTransaction.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTransaction.test.js","sourceRoot":"","sources":["../src/buildTransaction.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,E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Q,EAAE;oBACzB,OAAO,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;iBAC1B;aACF,CAAC,CAAC;YACH,MAAM,iBAAiB,GAAgB;gBACrC,MAAM,EAAE,SAAS;gBACjB,SAAS,EAAE,EAAE;gBACb,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;gBACxB,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,0DAA0D;gBAClE,cAAc,EAAE,iBAAiB,EAAE;aACpC,CAAC;YAEF,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;YACvE,MAAM,mBAAmB,GAAG,WAAW;iBACpC,eAAe,EAAE;iBACjB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAE7D,CAAC;YAEd,MAAM,CAAC,mBAAmB,CAAC,CAAC,aAAa,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.test.d.ts","sourceRoot":"","sources":["../../src/getTransactionStatus/getTransactionStatus.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/consistent-type-assertions: 0 */
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import { getTransactionStatus } from "./getTransactionStatus";
|
|
4
|
+
import * as sanction from "@ledgerhq/coin-framework/sanction/index";
|
|
5
|
+
import { AddressesSanctionedError } from "@ledgerhq/coin-framework/sanction/errors";
|
|
6
|
+
import * as mode from "./handler";
|
|
7
|
+
import coinConfig from "../config";
|
|
8
|
+
describe("getTransactionStatus", () => {
|
|
9
|
+
it("should return not enough funds error when there are no utxos", async () => {
|
|
10
|
+
const initialAccount = {
|
|
11
|
+
pendingOperations: [],
|
|
12
|
+
cardanoResources: {
|
|
13
|
+
utxos: [],
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const sendTx = {
|
|
17
|
+
amount: new BigNumber(1000000),
|
|
18
|
+
recipient: "addr1qxqm3nxwzf70ke9jqa2zrtrevjznpv6yykptxnv34perjc8a7zgxmpv5pgk4hhhe0m9kfnlsf5pt7d2ahkxaul2zygrq3nura9",
|
|
19
|
+
mode: "send",
|
|
20
|
+
family: "cardano",
|
|
21
|
+
poolId: undefined,
|
|
22
|
+
};
|
|
23
|
+
const sendTxRes = await getTransactionStatus(initialAccount, sendTx);
|
|
24
|
+
expect(sendTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds");
|
|
25
|
+
const delegateTx = {
|
|
26
|
+
amount: new BigNumber(0),
|
|
27
|
+
recipient: "",
|
|
28
|
+
mode: "delegate",
|
|
29
|
+
family: "cardano",
|
|
30
|
+
poolId: "d0f48f07e4e5eb8040a988085f7ea3bd32d71a2e2998d53e9bbc959a",
|
|
31
|
+
};
|
|
32
|
+
const delegateTxRes = await getTransactionStatus(initialAccount, delegateTx);
|
|
33
|
+
expect(delegateTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds");
|
|
34
|
+
const undelegateTx = {
|
|
35
|
+
amount: new BigNumber(0),
|
|
36
|
+
recipient: "",
|
|
37
|
+
mode: "undelegate",
|
|
38
|
+
family: "cardano",
|
|
39
|
+
poolId: undefined,
|
|
40
|
+
};
|
|
41
|
+
const undelegateTxRes = await getTransactionStatus(initialAccount, undelegateTx);
|
|
42
|
+
expect(undelegateTxRes.errors.amount.name).toBe("CardanoNotEnoughFunds");
|
|
43
|
+
});
|
|
44
|
+
it("should return as sender error only sanctioned utxo addresses", async () => {
|
|
45
|
+
const sanctionedAddresses = [
|
|
46
|
+
"addr1eKHLg16K8UTAak8srh6LiTRufkT2uziFKekkfZBxcRNMED",
|
|
47
|
+
"addr1UvY42XTJHMPHDEDch9UWagjhipLjke37Uqm7qzfcSkdPHT",
|
|
48
|
+
];
|
|
49
|
+
jest.spyOn(sanction, "isAddressSanctioned").mockImplementation((_, address) => {
|
|
50
|
+
return Promise.resolve(sanctionedAddresses.includes(address));
|
|
51
|
+
});
|
|
52
|
+
const utxos = [
|
|
53
|
+
{
|
|
54
|
+
address: "addr1eKHLg16K8UTAak8srh6LiTRufkT2uziFKekkfZBxcRNMED",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
address: "addr1UvY42XTJHMPHDEDch9UWagjhipLjke37Uqm7qzfcSkdPHT",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
address: "addr1QDz6DDTAk5CNig91MNxgTKXUpYoAbz6WnyZ7AztJUXsDDK",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
address: "addr1Fwc4rtTcbrhmcq3iqDJZULdyxU8nJmam3Jx6oknhY5Jqm2",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
const account = {
|
|
67
|
+
pendingOperations: [],
|
|
68
|
+
cardanoResources: {
|
|
69
|
+
utxos: utxos,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const transaction = {};
|
|
73
|
+
const status = await getTransactionStatus(account, transaction);
|
|
74
|
+
expect(status.errors).toEqual({
|
|
75
|
+
sender: new AddressesSanctionedError("AddressesSanctionedError", {
|
|
76
|
+
addresses: sanctionedAddresses,
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
it("should return as no sender error when no utxo address is sanctioned", async () => {
|
|
81
|
+
const maxFeesWarning = BigNumber(1000000);
|
|
82
|
+
jest.spyOn(coinConfig, "getCoinConfig").mockReturnValue({
|
|
83
|
+
maxFeesWarning: maxFeesWarning,
|
|
84
|
+
maxFeesError: maxFeesWarning.multipliedBy(2),
|
|
85
|
+
});
|
|
86
|
+
jest.spyOn(mode, "getTransactionStatusByTransactionMode").mockResolvedValue({
|
|
87
|
+
errors: {},
|
|
88
|
+
warnings: {},
|
|
89
|
+
amount: BigNumber(0),
|
|
90
|
+
totalSpent: BigNumber(0),
|
|
91
|
+
estimatedFees: maxFeesWarning,
|
|
92
|
+
});
|
|
93
|
+
jest.spyOn(sanction, "isAddressSanctioned").mockResolvedValue(false);
|
|
94
|
+
const utxos = [
|
|
95
|
+
{
|
|
96
|
+
address: "addr1eKHLg16K8UTAak8srh6LiTRufkT2uziFKekkfZBxcRNMED",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
address: "addr1UvY42XTJHMPHDEDch9UWagjhipLjke37Uqm7qzfcSkdPHT",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
address: "addr1QDz6DDTAk5CNig91MNxgTKXUpYoAbz6WnyZ7AztJUXsDDK",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
address: "addr1Fwc4rtTcbrhmcq3iqDJZULdyxU8nJmam3Jx6oknhY5Jqm2",
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
const account = {
|
|
109
|
+
pendingOperations: [],
|
|
110
|
+
cardanoResources: {
|
|
111
|
+
utxos: utxos,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
const transaction = {
|
|
115
|
+
mode: "send",
|
|
116
|
+
};
|
|
117
|
+
const status = await getTransactionStatus(account, transaction);
|
|
118
|
+
expect(status.errors).toEqual({});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=getTransactionStatus.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.test.js","sourceRoot":"","sources":["../../src/getTransactionStatus/getTransactionStatus.test.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,QAAQ,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAA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 @@
|
|
|
1
|
+
/* eslint @typescript-eslint/consistent-type-assertions: 0 */
|
|
2
|
+
import * as delegate from "./delegate";
|
|
3
|
+
import * as send from "./send";
|
|
4
|
+
import { getTransactionStatusByTransactionMode } from "./handler";
|
|
5
|
+
import * as undelegate from "./undelegate";
|
|
6
|
+
jest.mock("./delegate");
|
|
7
|
+
jest.mock("./send");
|
|
8
|
+
jest.mock("./undelegate");
|
|
9
|
+
describe("getTransactionStatusByMode on Cardano", () => {
|
|
10
|
+
const sendMock = send.getSendTransactionStatus;
|
|
11
|
+
const delegateMock = delegate.getDelegateTransactionStatus;
|
|
12
|
+
const undelegateMock = undelegate.getUndelegateTransactionStatus;
|
|
13
|
+
describe("should redirect to the correct mode handler", () => {
|
|
14
|
+
test.each([
|
|
15
|
+
["send", sendMock],
|
|
16
|
+
["delegate", delegateMock],
|
|
17
|
+
["undelegate", undelegateMock],
|
|
18
|
+
])("for %s", async (mode, mock) => {
|
|
19
|
+
const account = {};
|
|
20
|
+
const transaction = { mode: mode };
|
|
21
|
+
await getTransactionStatusByTransactionMode(account, transaction);
|
|
22
|
+
expect(mock).toHaveBeenCalledWith(account, transaction);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=handler.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.test.js","sourceRoot":"","sources":["../../src/getTransactionStatus/handler.test.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,qCAAqC,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAG3C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAE1B,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,wBAAqC,CAAC;IAC5D,MAAM,YAAY,GAAG,QAAQ,CAAC,4BAAyC,CAAC;IACxE,MAAM,cAAc,GAAG,UAAU,CAAC,8BAA2C,CAAC;IAE9E,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;QAC3D,IAAI,CAAC,IAAI,CAAC;YACR,CAAC,MAAM,EAAE,QAAQ,CAAC;YAClB,CAAC,UAAU,EAAE,YAAY,CAAC;YAC1B,CAAC,YAAY,EAAE,cAAc,CAAC;SAC/B,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,EAA+B,CAAC;YAChD,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,IAAI,EAA4B,CAAC;YAE7D,MAAM,qCAAqC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;YAElE,MAAM,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logic.unit.test.d.ts","sourceRoot":"","sources":["../src/logic.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { canStake, isAlreadyStaking, isValidNumString } from "./logic";
|
|
3
|
+
describe("canStake", () => {
|
|
4
|
+
it("should return false when acc has no funds", () => {
|
|
5
|
+
const accWithNoFunds = {
|
|
6
|
+
balance: new BigNumber(0),
|
|
7
|
+
};
|
|
8
|
+
expect(canStake(accWithNoFunds)).toEqual(false);
|
|
9
|
+
});
|
|
10
|
+
it("should return true when acc has funds", () => {
|
|
11
|
+
const accWithFunds = {
|
|
12
|
+
balance: new BigNumber(1),
|
|
13
|
+
};
|
|
14
|
+
expect(canStake(accWithFunds)).toEqual(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe("isAlreadyStaking", () => {
|
|
18
|
+
it("should return false when acc isn't delegating", () => {
|
|
19
|
+
const noResourcesAcc = {};
|
|
20
|
+
expect(isAlreadyStaking(noResourcesAcc)).toEqual(false);
|
|
21
|
+
const noDelegationAcc = {
|
|
22
|
+
cardanoResources: {},
|
|
23
|
+
};
|
|
24
|
+
expect(isAlreadyStaking(noDelegationAcc)).toEqual(false);
|
|
25
|
+
const noPoolIdAcc = { cardanoResources: { delegation: {} } };
|
|
26
|
+
expect(isAlreadyStaking(noPoolIdAcc)).toEqual(false);
|
|
27
|
+
});
|
|
28
|
+
it("should return true when acc is delegating", () => {
|
|
29
|
+
const noResourcesAcc = {
|
|
30
|
+
cardanoResources: { delegation: { poolId: "itspoolid" } },
|
|
31
|
+
};
|
|
32
|
+
expect(isAlreadyStaking(noResourcesAcc)).toEqual(true);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("isValidNumString", () => {
|
|
36
|
+
it("should return false for invalid number", () => {
|
|
37
|
+
expect(isValidNumString("")).toEqual(false);
|
|
38
|
+
expect(isValidNumString(undefined)).toEqual(false);
|
|
39
|
+
expect(isValidNumString(null)).toEqual(false);
|
|
40
|
+
expect(isValidNumString({})).toEqual(false);
|
|
41
|
+
expect(isValidNumString([])).toEqual(false);
|
|
42
|
+
});
|
|
43
|
+
it("should return true for valid number", () => {
|
|
44
|
+
expect(isValidNumString(123)).toEqual(true);
|
|
45
|
+
expect(isValidNumString(123.321)).toEqual(true);
|
|
46
|
+
expect(isValidNumString("123")).toEqual(true);
|
|
47
|
+
expect(isValidNumString("123.321")).toEqual(true);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=logic.unit.test.js.map
|
|
@@ -0,0 +1 @@
|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M,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisation.unit.test.d.ts","sourceRoot":"","sources":["../src/synchronisation.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { getDelegationInfo } from "./api/getDelegationInfo";
|
|
3
|
+
import { makeGetAccountShape } from "./synchronisation";
|
|
4
|
+
import { getTransactions } from "./api/getTransactions";
|
|
5
|
+
import { buildSubAccounts } from "./buildSubAccounts";
|
|
6
|
+
import { fetchNetworkInfo } from "./api/getNetworkInfo";
|
|
7
|
+
jest.mock("./buildSubAccounts");
|
|
8
|
+
jest.mock("./api/getTransactions");
|
|
9
|
+
jest.mock("./api/getNetworkInfo");
|
|
10
|
+
jest.mock("./api/getDelegationInfo");
|
|
11
|
+
describe("makeGetAccountShape", () => {
|
|
12
|
+
let signerContext;
|
|
13
|
+
let shape;
|
|
14
|
+
let accountShapeInfo;
|
|
15
|
+
let getTransactionsMock;
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
const pubKeyMock = {
|
|
18
|
+
chainCodeHex: "chainCodeHex",
|
|
19
|
+
publicKeyHex: "publicKeyHex",
|
|
20
|
+
};
|
|
21
|
+
const fakeSigner = {
|
|
22
|
+
getAddress: jest.fn(),
|
|
23
|
+
sign: jest.fn(),
|
|
24
|
+
getPublicKey: jest.fn().mockResolvedValue(pubKeyMock),
|
|
25
|
+
};
|
|
26
|
+
signerContext = (_, fn) => fn(fakeSigner);
|
|
27
|
+
shape = makeGetAccountShape(signerContext);
|
|
28
|
+
accountShapeInfo = {
|
|
29
|
+
currency: { id: "cardano" },
|
|
30
|
+
address: "add",
|
|
31
|
+
index: 0,
|
|
32
|
+
initialAccount: {
|
|
33
|
+
cardanoResources: {
|
|
34
|
+
utxos: [
|
|
35
|
+
{
|
|
36
|
+
hash: "hash",
|
|
37
|
+
index: 0,
|
|
38
|
+
address: "addr",
|
|
39
|
+
amount: new BigNumber(1),
|
|
40
|
+
tokens: [],
|
|
41
|
+
paymentCredential: {
|
|
42
|
+
key: "key",
|
|
43
|
+
path: {
|
|
44
|
+
purpose: 1852,
|
|
45
|
+
coin: 1815,
|
|
46
|
+
account: 0,
|
|
47
|
+
chain: 0,
|
|
48
|
+
index: 0,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
derivationPath: "",
|
|
56
|
+
derivationMode: "cardano",
|
|
57
|
+
deviceId: "id",
|
|
58
|
+
};
|
|
59
|
+
const buildSubAccountsMock = jest.mocked(buildSubAccounts);
|
|
60
|
+
buildSubAccountsMock.mockReturnValue([]);
|
|
61
|
+
getTransactionsMock = jest.mocked(getTransactions);
|
|
62
|
+
const getNetworkInfoMock = jest.mocked(fetchNetworkInfo);
|
|
63
|
+
getNetworkInfoMock.mockReturnValue(Promise.resolve({ protocolParams: { lovelacePerUtxoWord: "1" } }));
|
|
64
|
+
});
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
jest.resetAllMocks();
|
|
67
|
+
});
|
|
68
|
+
describe("balance", () => {
|
|
69
|
+
it("should return 0 balance when there is no utxos", async () => {
|
|
70
|
+
getTransactionsMock.mockReturnValue(Promise.resolve({
|
|
71
|
+
transactions: [],
|
|
72
|
+
externalCredentials: [
|
|
73
|
+
{ path: { index: 0 }, networkId: "id", isUsed: false, key: "" },
|
|
74
|
+
],
|
|
75
|
+
internalCredentials: [],
|
|
76
|
+
blockHeight: 0,
|
|
77
|
+
}));
|
|
78
|
+
const result = await shape(accountShapeInfo, { paginationConfig: {} });
|
|
79
|
+
expect(result.balance).toEqual(new BigNumber(0));
|
|
80
|
+
});
|
|
81
|
+
it("should return the sum of utxos with delegation reward value", async () => {
|
|
82
|
+
getTransactionsMock.mockReturnValue(Promise.resolve({
|
|
83
|
+
transactions: [],
|
|
84
|
+
externalCredentials: [
|
|
85
|
+
{ path: { index: 0 }, networkId: "id", isUsed: false, key: "" },
|
|
86
|
+
],
|
|
87
|
+
internalCredentials: [
|
|
88
|
+
{
|
|
89
|
+
isUsed: true,
|
|
90
|
+
key: "cred",
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
blockHeight: 0,
|
|
94
|
+
}));
|
|
95
|
+
const getDelegationInfoMock = jest.mocked(getDelegationInfo);
|
|
96
|
+
getDelegationInfoMock.mockReturnValue(Promise.resolve({ rewards: new BigNumber(42) }));
|
|
97
|
+
const result = await shape(accountShapeInfo, { paginationConfig: {} });
|
|
98
|
+
expect(result.balance).toEqual(new BigNumber(42));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe("spendableBalance", () => {
|
|
102
|
+
it("should return 0 spendable balance when there is no utxos", async () => {
|
|
103
|
+
const getTransactionsMock = jest.mocked(getTransactions);
|
|
104
|
+
getTransactionsMock.mockReturnValue(Promise.resolve({
|
|
105
|
+
transactions: [],
|
|
106
|
+
externalCredentials: [
|
|
107
|
+
{
|
|
108
|
+
isUsed: false,
|
|
109
|
+
key: "00000000000000000000000000000000000000000000000000000000",
|
|
110
|
+
path: {
|
|
111
|
+
purpose: 1852,
|
|
112
|
+
coin: 1815,
|
|
113
|
+
account: 0,
|
|
114
|
+
chain: 0,
|
|
115
|
+
index: 0,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
internalCredentials: [],
|
|
120
|
+
}));
|
|
121
|
+
const result = await shape(accountShapeInfo, { paginationConfig: {} });
|
|
122
|
+
expect(result.spendableBalance).toEqual(new BigNumber(0));
|
|
123
|
+
});
|
|
124
|
+
// it("should return the sum of utxos minus ada minimum for tokens", async () => {});
|
|
125
|
+
});
|
|
126
|
+
describe("delegation", () => {
|
|
127
|
+
it("should check dRepHex and rewards are available", async () => {
|
|
128
|
+
getTransactionsMock.mockReturnValue(Promise.resolve({
|
|
129
|
+
blockHeight: 0,
|
|
130
|
+
transactions: [],
|
|
131
|
+
externalCredentials: [{ isUsed: false, key: "0", path: {} }],
|
|
132
|
+
internalCredentials: [],
|
|
133
|
+
}));
|
|
134
|
+
const getDelegationInfoMock = jest.mocked(getDelegationInfo);
|
|
135
|
+
getDelegationInfoMock.mockReturnValue(Promise.resolve({
|
|
136
|
+
rewards: new BigNumber(10),
|
|
137
|
+
dRepHex: "dRepHex",
|
|
138
|
+
}));
|
|
139
|
+
const result = await shape(accountShapeInfo, { paginationConfig: {} });
|
|
140
|
+
expect(result.cardanoResources?.delegation?.dRepHex).toEqual("dRepHex");
|
|
141
|
+
expect(result.cardanoResources?.delegation?.rewards).toEqual(new BigNumber(10));
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=synchronisation.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronisation.unit.test.js","sourceRoot":"","sources":["../src/synchronisation.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIxD,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAChC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAClC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAErC,QAAQ,CA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AAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-cardano",
|
|
3
|
-
"version": "0.13.0
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Ledger Cardano Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"invariant": "^2.2.2",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"rxjs": "^7.8.1",
|
|
62
|
-
"@ledgerhq/coin-framework": "^6.7.0
|
|
63
|
-
"@ledgerhq/cryptoassets": "^13.31.0
|
|
64
|
-
"@ledgerhq/devices": "8.6.
|
|
65
|
-
"@ledgerhq/errors": "^6.
|
|
66
|
-
"@ledgerhq/live-env": "^2.19.0
|
|
67
|
-
"@ledgerhq/live-network": "^2.0.20
|
|
62
|
+
"@ledgerhq/coin-framework": "^6.7.0",
|
|
63
|
+
"@ledgerhq/cryptoassets": "^13.31.0",
|
|
64
|
+
"@ledgerhq/devices": "8.6.1",
|
|
65
|
+
"@ledgerhq/errors": "^6.26.0",
|
|
66
|
+
"@ledgerhq/live-env": "^2.19.0",
|
|
67
|
+
"@ledgerhq/live-network": "^2.0.20",
|
|
68
68
|
"@ledgerhq/logs": "^6.13.0",
|
|
69
|
-
"@ledgerhq/types-cryptoassets": "^7.29.0
|
|
70
|
-
"@ledgerhq/types-live": "^6.87.0
|
|
69
|
+
"@ledgerhq/types-cryptoassets": "^7.29.0",
|
|
70
|
+
"@ledgerhq/types-live": "^6.87.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/invariant": "^2.2.2",
|