@ledgerhq/coin-canton 0.5.0-nightly.5 → 0.5.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 +32 -47
- package/lib/api/getBalance.integ.test.js +5 -9
- package/lib/api/getBalance.integ.test.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +25 -20
- package/lib/api/index.js.map +1 -1
- package/lib/api/lastBlock.integ.test.js +1 -1
- package/lib/api/lastBlock.integ.test.js.map +1 -1
- package/lib/api/listOperations.integ.test.js +1 -1
- package/lib/api/listOperations.integ.test.js.map +1 -1
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +2 -3
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/broadcast.test.js +0 -9
- package/lib/bridge/broadcast.test.js.map +1 -1
- package/lib/bridge/createTransaction.js +1 -1
- package/lib/bridge/createTransaction.js.map +1 -1
- package/lib/bridge/getTransactionStatus.js +1 -1
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/index.d.ts.map +1 -1
- package/lib/bridge/index.js +0 -3
- package/lib/bridge/index.js.map +1 -1
- package/lib/bridge/onboard.d.ts +5 -7
- package/lib/bridge/onboard.d.ts.map +1 -1
- package/lib/bridge/onboard.integ.test.js +11 -14
- package/lib/bridge/onboard.integ.test.js.map +1 -1
- package/lib/bridge/onboard.js +42 -110
- package/lib/bridge/onboard.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +7 -5
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/signOperation.d.ts.map +1 -1
- package/lib/bridge/signOperation.js +11 -14
- package/lib/bridge/signOperation.js.map +1 -1
- package/lib/bridge/sync.d.ts +1 -2
- package/lib/bridge/sync.d.ts.map +1 -1
- package/lib/bridge/sync.js +21 -41
- package/lib/bridge/sync.js.map +1 -1
- package/lib/bridge/updateTransaction.d.ts.map +1 -1
- package/lib/bridge/updateTransaction.js +4 -0
- package/lib/bridge/updateTransaction.js.map +1 -1
- package/lib/common-logic/account/getBalance.d.ts +1 -2
- package/lib/common-logic/account/getBalance.d.ts.map +1 -1
- package/lib/common-logic/account/getBalance.js +7 -7
- package/lib/common-logic/account/getBalance.js.map +1 -1
- package/lib/common-logic/account/getBalance.unit.test.js +3 -6
- package/lib/common-logic/account/getBalance.unit.test.js.map +1 -1
- package/lib/common-logic/history/lastBlock.d.ts +1 -2
- package/lib/common-logic/history/lastBlock.d.ts.map +1 -1
- package/lib/common-logic/history/lastBlock.js +3 -3
- package/lib/common-logic/history/lastBlock.js.map +1 -1
- package/lib/common-logic/history/lastBlock.test.js +2 -5
- package/lib/common-logic/history/lastBlock.test.js.map +1 -1
- package/lib/common-logic/history/listOperations.d.ts +1 -2
- package/lib/common-logic/history/listOperations.d.ts.map +1 -1
- package/lib/common-logic/history/listOperations.js +2 -2
- package/lib/common-logic/history/listOperations.js.map +1 -1
- package/lib/common-logic/transaction/broadcast.d.ts +1 -2
- package/lib/common-logic/transaction/broadcast.d.ts.map +1 -1
- package/lib/common-logic/transaction/broadcast.js +4 -5
- package/lib/common-logic/transaction/broadcast.js.map +1 -1
- package/lib/common-logic/transaction/broadcast.test.js +5 -8
- package/lib/common-logic/transaction/broadcast.test.js.map +1 -1
- package/lib/common-logic/transaction/combine.d.ts +1 -1
- package/lib/common-logic/transaction/combine.d.ts.map +1 -1
- package/lib/common-logic/transaction/combine.js +3 -2
- package/lib/common-logic/transaction/combine.js.map +1 -1
- package/lib/common-logic/transaction/combine.test.js +13 -3
- package/lib/common-logic/transaction/combine.test.js.map +1 -1
- package/lib/common-logic/transaction/craftTransaction.d.ts +4 -8
- package/lib/common-logic/transaction/craftTransaction.d.ts.map +1 -1
- package/lib/common-logic/transaction/craftTransaction.js +12 -15
- package/lib/common-logic/transaction/craftTransaction.js.map +1 -1
- package/lib/common-logic/transaction/estimateFees.d.ts +1 -2
- package/lib/common-logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib/common-logic/transaction/estimateFees.js +3 -7
- package/lib/common-logic/transaction/estimateFees.js.map +1 -1
- package/lib/config.d.ts +0 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/network/gateway.d.ts +17 -41
- package/lib/network/gateway.d.ts.map +1 -1
- package/lib/network/gateway.integ.test.js +15 -19
- package/lib/network/gateway.integ.test.js.map +1 -1
- package/lib/network/gateway.js +48 -74
- package/lib/network/gateway.js.map +1 -1
- package/lib/network/node.d.ts +2 -2
- package/lib/network/node.d.ts.map +1 -1
- package/lib/network/node.js.map +1 -1
- package/lib/network/types.d.ts +1 -1
- package/lib/network/types.d.ts.map +1 -1
- package/lib/signer/getAddress.d.ts.map +1 -1
- package/lib/signer/getAddress.js +2 -2
- package/lib/signer/getAddress.js.map +1 -1
- package/lib/types/bridge.d.ts +3 -18
- package/lib/types/bridge.d.ts.map +1 -1
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/onboard.d.ts +0 -2
- package/lib/types/onboard.d.ts.map +1 -1
- package/lib/types/onboard.js.map +1 -1
- package/lib/types/signer.d.ts +1 -2
- package/lib/types/signer.d.ts.map +1 -1
- package/lib-es/api/getBalance.integ.test.js +5 -9
- package/lib-es/api/getBalance.integ.test.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +24 -19
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/api/lastBlock.integ.test.js +1 -1
- package/lib-es/api/lastBlock.integ.test.js.map +1 -1
- package/lib-es/api/listOperations.integ.test.js +1 -1
- package/lib-es/api/listOperations.integ.test.js.map +1 -1
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +2 -3
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/broadcast.test.js +0 -9
- package/lib-es/bridge/broadcast.test.js.map +1 -1
- package/lib-es/bridge/createTransaction.js +1 -1
- package/lib-es/bridge/createTransaction.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +1 -1
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/index.d.ts.map +1 -1
- package/lib-es/bridge/index.js +0 -3
- package/lib-es/bridge/index.js.map +1 -1
- package/lib-es/bridge/onboard.d.ts +5 -7
- package/lib-es/bridge/onboard.d.ts.map +1 -1
- package/lib-es/bridge/onboard.integ.test.js +11 -14
- package/lib-es/bridge/onboard.integ.test.js.map +1 -1
- package/lib-es/bridge/onboard.js +42 -107
- package/lib-es/bridge/onboard.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +8 -6
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/signOperation.js +12 -15
- package/lib-es/bridge/signOperation.js.map +1 -1
- package/lib-es/bridge/sync.d.ts +1 -2
- package/lib-es/bridge/sync.d.ts.map +1 -1
- package/lib-es/bridge/sync.js +22 -42
- package/lib-es/bridge/sync.js.map +1 -1
- package/lib-es/bridge/updateTransaction.d.ts.map +1 -1
- package/lib-es/bridge/updateTransaction.js +4 -0
- package/lib-es/bridge/updateTransaction.js.map +1 -1
- package/lib-es/common-logic/account/getBalance.d.ts +1 -2
- package/lib-es/common-logic/account/getBalance.d.ts.map +1 -1
- package/lib-es/common-logic/account/getBalance.js +7 -7
- package/lib-es/common-logic/account/getBalance.js.map +1 -1
- package/lib-es/common-logic/account/getBalance.unit.test.js +3 -6
- package/lib-es/common-logic/account/getBalance.unit.test.js.map +1 -1
- package/lib-es/common-logic/history/lastBlock.d.ts +1 -2
- package/lib-es/common-logic/history/lastBlock.d.ts.map +1 -1
- package/lib-es/common-logic/history/lastBlock.js +3 -3
- package/lib-es/common-logic/history/lastBlock.js.map +1 -1
- package/lib-es/common-logic/history/lastBlock.test.js +2 -5
- package/lib-es/common-logic/history/lastBlock.test.js.map +1 -1
- package/lib-es/common-logic/history/listOperations.d.ts +1 -2
- package/lib-es/common-logic/history/listOperations.d.ts.map +1 -1
- package/lib-es/common-logic/history/listOperations.js +2 -2
- package/lib-es/common-logic/history/listOperations.js.map +1 -1
- package/lib-es/common-logic/transaction/broadcast.d.ts +1 -2
- package/lib-es/common-logic/transaction/broadcast.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/broadcast.js +4 -5
- package/lib-es/common-logic/transaction/broadcast.js.map +1 -1
- package/lib-es/common-logic/transaction/broadcast.test.js +5 -8
- package/lib-es/common-logic/transaction/broadcast.test.js.map +1 -1
- package/lib-es/common-logic/transaction/combine.d.ts +1 -1
- package/lib-es/common-logic/transaction/combine.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/combine.js +3 -2
- package/lib-es/common-logic/transaction/combine.js.map +1 -1
- package/lib-es/common-logic/transaction/combine.test.js +13 -3
- package/lib-es/common-logic/transaction/combine.test.js.map +1 -1
- package/lib-es/common-logic/transaction/craftTransaction.d.ts +4 -8
- package/lib-es/common-logic/transaction/craftTransaction.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/craftTransaction.js +12 -15
- package/lib-es/common-logic/transaction/craftTransaction.js.map +1 -1
- package/lib-es/common-logic/transaction/estimateFees.d.ts +1 -2
- package/lib-es/common-logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib-es/common-logic/transaction/estimateFees.js +3 -4
- package/lib-es/common-logic/transaction/estimateFees.js.map +1 -1
- package/lib-es/config.d.ts +0 -1
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js.map +1 -1
- package/lib-es/network/gateway.d.ts +17 -41
- package/lib-es/network/gateway.d.ts.map +1 -1
- package/lib-es/network/gateway.integ.test.js +15 -19
- package/lib-es/network/gateway.integ.test.js.map +1 -1
- package/lib-es/network/gateway.js +48 -73
- package/lib-es/network/gateway.js.map +1 -1
- package/lib-es/network/node.d.ts +2 -2
- package/lib-es/network/node.d.ts.map +1 -1
- package/lib-es/network/node.js.map +1 -1
- package/lib-es/network/types.d.ts +1 -1
- package/lib-es/network/types.d.ts.map +1 -1
- package/lib-es/signer/getAddress.d.ts.map +1 -1
- package/lib-es/signer/getAddress.js +2 -2
- package/lib-es/signer/getAddress.js.map +1 -1
- package/lib-es/types/bridge.d.ts +3 -18
- package/lib-es/types/bridge.d.ts.map +1 -1
- package/lib-es/types/index.d.ts +10 -0
- package/lib-es/types/index.d.ts.map +1 -1
- package/lib-es/types/onboard.d.ts +0 -2
- package/lib-es/types/onboard.d.ts.map +1 -1
- package/lib-es/types/onboard.js.map +1 -1
- package/lib-es/types/signer.d.ts +1 -2
- package/lib-es/types/signer.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/api/getBalance.integ.test.ts +6 -9
- package/src/api/index.ts +44 -22
- package/src/api/lastBlock.integ.test.ts +1 -1
- package/src/api/listOperations.integ.test.ts +1 -1
- package/src/bridge/broadcast.test.ts +0 -11
- package/src/bridge/broadcast.ts +2 -4
- package/src/bridge/createTransaction.ts +1 -1
- package/src/bridge/getTransactionStatus.ts +1 -1
- package/src/bridge/index.ts +0 -3
- package/src/bridge/onboard.integ.test.ts +13 -25
- package/src/bridge/onboard.ts +51 -143
- package/src/bridge/prepareTransaction.ts +15 -6
- package/src/bridge/signOperation.ts +20 -26
- package/src/bridge/sync.ts +27 -53
- package/src/bridge/updateTransaction.ts +5 -0
- package/src/common-logic/account/getBalance.ts +7 -12
- package/src/common-logic/account/getBalance.unit.test.ts +3 -8
- package/src/common-logic/history/lastBlock.test.ts +2 -7
- package/src/common-logic/history/lastBlock.ts +3 -5
- package/src/common-logic/history/listOperations.ts +2 -3
- package/src/common-logic/transaction/broadcast.test.ts +5 -10
- package/src/common-logic/transaction/broadcast.ts +3 -7
- package/src/common-logic/transaction/combine.test.ts +13 -3
- package/src/common-logic/transaction/combine.ts +4 -2
- package/src/common-logic/transaction/craftTransaction.ts +15 -30
- package/src/common-logic/transaction/estimateFees.ts +3 -7
- package/src/config.ts +0 -1
- package/src/network/gateway.integ.test.ts +12 -31
- package/src/network/gateway.ts +62 -141
- package/src/network/node.ts +3 -3
- package/src/network/types.ts +1 -1
- package/src/signer/getAddress.ts +4 -6
- package/src/types/bridge.ts +0 -21
- package/src/types/index.ts +11 -0
- package/src/types/onboard.ts +0 -3
- package/src/types/signer.ts +1 -2
- package/lib/bridge/serialization.d.ts +0 -4
- package/lib/bridge/serialization.d.ts.map +0 -1
- package/lib/bridge/serialization.js +0 -31
- package/lib/bridge/serialization.js.map +0 -1
- package/lib/bridge/sync.integ.test.d.ts +0 -2
- package/lib/bridge/sync.integ.test.d.ts.map +0 -1
- package/lib/bridge/sync.integ.test.js +0 -175
- package/lib/bridge/sync.integ.test.js.map +0 -1
- package/lib-es/bridge/serialization.d.ts +0 -4
- package/lib-es/bridge/serialization.d.ts.map +0 -1
- package/lib-es/bridge/serialization.js +0 -27
- package/lib-es/bridge/serialization.js.map +0 -1
- package/lib-es/bridge/sync.integ.test.d.ts +0 -2
- package/lib-es/bridge/sync.integ.test.d.ts.map +0 -1
- package/lib-es/bridge/sync.integ.test.js +0 -137
- package/lib-es/bridge/sync.integ.test.js.map +0 -1
- package/src/bridge/serialization.ts +0 -36
- package/src/bridge/sync.integ.test.ts +0 -180
|
@@ -13,11 +13,6 @@ import {
|
|
|
13
13
|
preparePreApprovalTransaction,
|
|
14
14
|
submitPreApprovalTransaction,
|
|
15
15
|
} from "./gateway";
|
|
16
|
-
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
17
|
-
|
|
18
|
-
const mockCurrency = {
|
|
19
|
-
id: "canton_network",
|
|
20
|
-
} as unknown as CryptoCurrency;
|
|
21
16
|
|
|
22
17
|
describe("gateway (devnet)", () => {
|
|
23
18
|
let onboardedAccount: {
|
|
@@ -55,7 +50,7 @@ describe("gateway (devnet)", () => {
|
|
|
55
50
|
};
|
|
56
51
|
|
|
57
52
|
// WHEN
|
|
58
|
-
const response = await prepareOnboarding(
|
|
53
|
+
const response = await prepareOnboarding(keyPair.publicKeyHex, "ed25519");
|
|
59
54
|
|
|
60
55
|
// THEN
|
|
61
56
|
expect(response).toHaveProperty("party_id");
|
|
@@ -63,8 +58,7 @@ describe("gateway (devnet)", () => {
|
|
|
63
58
|
expect(response).toHaveProperty("public_key_fingerprint");
|
|
64
59
|
expect(response).toHaveProperty("transactions");
|
|
65
60
|
expect(response.transactions).toHaveProperty("combined_hash");
|
|
66
|
-
expect(response.party_name).
|
|
67
|
-
expect(typeof response.party_name).toBe("string");
|
|
61
|
+
expect(response.party_name).toBe(keyPair.publicKeyHex);
|
|
68
62
|
|
|
69
63
|
expect(response.public_key_fingerprint).toBe(keyPair.fingerprint);
|
|
70
64
|
}, 30000);
|
|
@@ -75,20 +69,11 @@ describe("gateway (devnet)", () => {
|
|
|
75
69
|
// GIVEN
|
|
76
70
|
const { keyPair } = getOnboardedAccount();
|
|
77
71
|
const prepareRequest = { public_key: keyPair.publicKeyHex, public_key_type: "ed25519" };
|
|
78
|
-
const prepareResponse = await prepareOnboarding(
|
|
79
|
-
mockCurrency,
|
|
80
|
-
keyPair.publicKeyHex,
|
|
81
|
-
"ed25519",
|
|
82
|
-
);
|
|
72
|
+
const prepareResponse = await prepareOnboarding(keyPair.publicKeyHex, "ed25519");
|
|
83
73
|
const signature = keyPair.sign(prepareResponse.transactions.combined_hash);
|
|
84
74
|
|
|
85
75
|
// WHEN
|
|
86
|
-
const response = await submitOnboarding(
|
|
87
|
-
mockCurrency,
|
|
88
|
-
prepareRequest,
|
|
89
|
-
prepareResponse,
|
|
90
|
-
signature,
|
|
91
|
-
);
|
|
76
|
+
const response = await submitOnboarding(prepareRequest, prepareResponse, signature);
|
|
92
77
|
|
|
93
78
|
// Save onboarded account for all tests that need a valid party ID
|
|
94
79
|
onboardedAccount = {
|
|
@@ -106,7 +91,7 @@ describe("gateway (devnet)", () => {
|
|
|
106
91
|
|
|
107
92
|
describe("getLedgerEnd", () => {
|
|
108
93
|
it("should return ledger end", async () => {
|
|
109
|
-
const end = await getLedgerEnd(
|
|
94
|
+
const end = await getLedgerEnd();
|
|
110
95
|
expect(end).toBeGreaterThanOrEqual(0);
|
|
111
96
|
});
|
|
112
97
|
});
|
|
@@ -114,7 +99,7 @@ describe("gateway (devnet)", () => {
|
|
|
114
99
|
describe("getBalance", () => {
|
|
115
100
|
it("should return user balance", async () => {
|
|
116
101
|
const { partyId } = getOnboardedAccount();
|
|
117
|
-
const balance = await getBalance(
|
|
102
|
+
const balance = await getBalance(partyId);
|
|
118
103
|
expect(balance.length).toBeGreaterThanOrEqual(0);
|
|
119
104
|
if (balance.length > 0) {
|
|
120
105
|
expect(balance[0].amount).toBeGreaterThanOrEqual(0);
|
|
@@ -125,7 +110,7 @@ describe("gateway (devnet)", () => {
|
|
|
125
110
|
|
|
126
111
|
describe("getPartyById", () => {
|
|
127
112
|
it.skip("should return party info", async () => {
|
|
128
|
-
const party = await getPartyById(
|
|
113
|
+
const party = await getPartyById("4f2e1485107adf5f");
|
|
129
114
|
expect(party).toBeDefined();
|
|
130
115
|
});
|
|
131
116
|
});
|
|
@@ -133,7 +118,6 @@ describe("gateway (devnet)", () => {
|
|
|
133
118
|
describe("getPartyByPubKey", () => {
|
|
134
119
|
it.skip("should return party info", async () => {
|
|
135
120
|
const party = await getPartyByPubKey(
|
|
136
|
-
mockCurrency,
|
|
137
121
|
"122027c6dbbbdbffe0fa3122ae05175f3b9328e879e9ce96b670354deb64a45683c1",
|
|
138
122
|
);
|
|
139
123
|
expect(party).toBeDefined();
|
|
@@ -143,9 +127,7 @@ describe("gateway (devnet)", () => {
|
|
|
143
127
|
describe("getOperations", () => {
|
|
144
128
|
it("should return user transactions", async () => {
|
|
145
129
|
const { operations } = await getOperations(
|
|
146
|
-
mockCurrency,
|
|
147
130
|
"party-5f29bb32e9939939::12202becd8062a1d170209956cfd977fca76fcb4d2a892d08c77a7483f35a11d6440",
|
|
148
|
-
{},
|
|
149
131
|
);
|
|
150
132
|
expect(operations.length).toBeGreaterThanOrEqual(0);
|
|
151
133
|
});
|
|
@@ -158,7 +140,7 @@ describe("gateway (devnet)", () => {
|
|
|
158
140
|
const amount = 1000;
|
|
159
141
|
|
|
160
142
|
// WHEN
|
|
161
|
-
const response = await prepareTapRequest(
|
|
143
|
+
const response = await prepareTapRequest({ partyId, amount });
|
|
162
144
|
|
|
163
145
|
// THEN
|
|
164
146
|
expect(response).toHaveProperty("serialized");
|
|
@@ -172,14 +154,14 @@ describe("gateway (devnet)", () => {
|
|
|
172
154
|
it("should submit tap request with proper signature", async () => {
|
|
173
155
|
// GIVEN
|
|
174
156
|
const { keyPair, partyId } = getOnboardedAccount();
|
|
175
|
-
const tapPrepareResponse = await prepareTapRequest(
|
|
157
|
+
const tapPrepareResponse = await prepareTapRequest({
|
|
176
158
|
partyId,
|
|
177
159
|
amount: 1000,
|
|
178
160
|
});
|
|
179
161
|
const tapSignature = keyPair.sign(tapPrepareResponse.hash);
|
|
180
162
|
|
|
181
163
|
// WHEN
|
|
182
|
-
const response = await submitTapRequest(
|
|
164
|
+
const response = await submitTapRequest({
|
|
183
165
|
partyId,
|
|
184
166
|
serialized: tapPrepareResponse.serialized,
|
|
185
167
|
signature: tapSignature,
|
|
@@ -199,7 +181,7 @@ describe("gateway (devnet)", () => {
|
|
|
199
181
|
const { partyId } = getOnboardedAccount();
|
|
200
182
|
|
|
201
183
|
// WHEN
|
|
202
|
-
const response = await preparePreApprovalTransaction(
|
|
184
|
+
const response = await preparePreApprovalTransaction(partyId);
|
|
203
185
|
|
|
204
186
|
// THEN
|
|
205
187
|
expect(response).toHaveProperty("serialized");
|
|
@@ -213,12 +195,11 @@ describe("gateway (devnet)", () => {
|
|
|
213
195
|
it("should submit pre-approval transaction with proper signature", async () => {
|
|
214
196
|
// GIVEN
|
|
215
197
|
const { keyPair, partyId } = getOnboardedAccount();
|
|
216
|
-
const preparedTransaction = await preparePreApprovalTransaction(
|
|
198
|
+
const preparedTransaction = await preparePreApprovalTransaction(partyId);
|
|
217
199
|
const preApprovalSignature = keyPair.sign(preparedTransaction.hash);
|
|
218
200
|
|
|
219
201
|
// WHEN
|
|
220
202
|
const response = await submitPreApprovalTransaction(
|
|
221
|
-
mockCurrency,
|
|
222
203
|
partyId,
|
|
223
204
|
preparedTransaction,
|
|
224
205
|
preApprovalSignature,
|
package/src/network/gateway.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import network from "@ledgerhq/live-network";
|
|
2
|
-
import type { LiveNetworkRequest } from "@ledgerhq/live-network/network";
|
|
3
|
-
import { getEnv } from "@ledgerhq/live-env";
|
|
4
2
|
import coinConfig from "../config";
|
|
5
3
|
import {
|
|
6
4
|
PrepareTransactionRequest,
|
|
@@ -9,7 +7,6 @@ import {
|
|
|
9
7
|
SubmitTransactionResponse,
|
|
10
8
|
PreApprovalResult,
|
|
11
9
|
} from "../types/onboard";
|
|
12
|
-
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
13
10
|
|
|
14
11
|
type OnboardingPrepareResponse = {
|
|
15
12
|
party_id: string;
|
|
@@ -40,21 +37,6 @@ type OnboardingPrepareRequest = {
|
|
|
40
37
|
public_key_type: string;
|
|
41
38
|
};
|
|
42
39
|
|
|
43
|
-
export type PrepareTransferResponse = {
|
|
44
|
-
hash: string;
|
|
45
|
-
json: any; // The actual structure is complex, using any for now
|
|
46
|
-
serialized: string;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type PrepareTransferRequest = {
|
|
50
|
-
type: "token-transfer-request";
|
|
51
|
-
amount: string;
|
|
52
|
-
recipient: string;
|
|
53
|
-
execute_before_secs: number;
|
|
54
|
-
instrument_id: string;
|
|
55
|
-
reason?: string;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
40
|
type OnboardingSubmitRequest = {
|
|
59
41
|
prepare_request: OnboardingPrepareRequest;
|
|
60
42
|
prepare_response: OnboardingPrepareResponse;
|
|
@@ -73,7 +55,7 @@ type TransactionSubmitRequest = {
|
|
|
73
55
|
signature: string;
|
|
74
56
|
};
|
|
75
57
|
|
|
76
|
-
type TransactionSubmitResponse = {
|
|
58
|
+
type TransactionSubmitResponse = { updateId: string };
|
|
77
59
|
|
|
78
60
|
export type InstrumentBalance = {
|
|
79
61
|
instrument_id: string;
|
|
@@ -152,9 +134,6 @@ export type OperationInfo =
|
|
|
152
134
|
asset: string;
|
|
153
135
|
details: {
|
|
154
136
|
type: "pre-approval";
|
|
155
|
-
metadata: {
|
|
156
|
-
reason?: string;
|
|
157
|
-
};
|
|
158
137
|
};
|
|
159
138
|
},
|
|
160
139
|
];
|
|
@@ -197,9 +176,6 @@ export type OperationInfo =
|
|
|
197
176
|
asset: string;
|
|
198
177
|
details: {
|
|
199
178
|
type: "tap";
|
|
200
|
-
metadata: {
|
|
201
|
-
reason?: string;
|
|
202
|
-
};
|
|
203
179
|
};
|
|
204
180
|
},
|
|
205
181
|
];
|
|
@@ -242,9 +218,6 @@ export type OperationInfo =
|
|
|
242
218
|
asset: string;
|
|
243
219
|
details: {
|
|
244
220
|
type: "transfer";
|
|
245
|
-
metadata: {
|
|
246
|
-
reason?: string;
|
|
247
|
-
};
|
|
248
221
|
};
|
|
249
222
|
},
|
|
250
223
|
];
|
|
@@ -272,114 +245,84 @@ export type OperationInfo =
|
|
|
272
245
|
};
|
|
273
246
|
};
|
|
274
247
|
|
|
275
|
-
const getGatewayUrl = (
|
|
276
|
-
const getNodeId = (
|
|
277
|
-
coinConfig.getCoinConfig(currency).nodeId || "ledger-devnet-stg";
|
|
278
|
-
const getNetworkType = (currency: CryptoCurrency) => coinConfig.getCoinConfig(currency).networkType;
|
|
279
|
-
|
|
280
|
-
const gatewayNetwork = <T, U = unknown>(req: LiveNetworkRequest<U>) => {
|
|
281
|
-
const API_KEY = getEnv("CANTON_API_KEY");
|
|
282
|
-
return network<T, U>({
|
|
283
|
-
...req,
|
|
284
|
-
headers: {
|
|
285
|
-
...(req.headers || {}),
|
|
286
|
-
...(API_KEY && { "X-Ledger-Canton-Api-Key": API_KEY }),
|
|
287
|
-
},
|
|
288
|
-
});
|
|
289
|
-
};
|
|
248
|
+
const getGatewayUrl = () => coinConfig.getCoinConfig().gatewayUrl;
|
|
249
|
+
const getNodeId = () => coinConfig.getCoinConfig().nodeId || "ledger-devnet-stg";
|
|
290
250
|
|
|
291
251
|
export async function prepareOnboarding(
|
|
292
|
-
currency: CryptoCurrency,
|
|
293
252
|
pubKey: string,
|
|
294
253
|
pubKeyType: string,
|
|
295
254
|
): Promise<OnboardingPrepareResponse> {
|
|
296
|
-
const gatewayUrl = getGatewayUrl(
|
|
297
|
-
const nodeId = getNodeId(
|
|
255
|
+
const gatewayUrl = getGatewayUrl();
|
|
256
|
+
const nodeId = getNodeId();
|
|
298
257
|
const fullUrl = `${gatewayUrl}/v1/node/${nodeId}/onboarding/prepare`;
|
|
299
258
|
|
|
300
|
-
const { data } = await
|
|
259
|
+
const { data } = await network<OnboardingPrepareResponse>({
|
|
301
260
|
method: "POST",
|
|
302
261
|
url: fullUrl,
|
|
303
262
|
data: {
|
|
304
263
|
public_key: pubKey,
|
|
305
264
|
public_key_type: pubKeyType,
|
|
306
|
-
},
|
|
265
|
+
} satisfies OnboardingPrepareRequest,
|
|
307
266
|
});
|
|
308
267
|
|
|
309
268
|
return data;
|
|
310
269
|
}
|
|
311
270
|
|
|
312
271
|
export async function submitOnboarding(
|
|
313
|
-
currency: CryptoCurrency,
|
|
314
272
|
prepareRequest: OnboardingPrepareRequest,
|
|
315
273
|
prepareResponse: OnboardingPrepareResponse,
|
|
316
274
|
signature: string,
|
|
317
275
|
) {
|
|
318
|
-
const { data } = await
|
|
276
|
+
const { data } = await network<OnboardingSubmitResponse>({
|
|
319
277
|
method: "POST",
|
|
320
|
-
url: `${getGatewayUrl(
|
|
278
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/onboarding/submit`,
|
|
321
279
|
data: {
|
|
322
280
|
prepare_request: prepareRequest,
|
|
323
281
|
prepare_response: prepareResponse,
|
|
324
282
|
signature,
|
|
325
|
-
},
|
|
283
|
+
} satisfies OnboardingSubmitRequest,
|
|
326
284
|
});
|
|
327
285
|
return data;
|
|
328
286
|
}
|
|
329
287
|
|
|
330
|
-
export async function submit(
|
|
331
|
-
|
|
332
|
-
partyId: string,
|
|
333
|
-
serialized: string,
|
|
334
|
-
signature: string,
|
|
335
|
-
) {
|
|
336
|
-
const { data } = await gatewayNetwork<TransactionSubmitResponse, TransactionSubmitRequest>({
|
|
288
|
+
export async function submit(serializedTx: string, signature: string) {
|
|
289
|
+
const { data } = await network<TransactionSubmitResponse>({
|
|
337
290
|
method: "POST",
|
|
338
|
-
url: `${getGatewayUrl(
|
|
291
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/transaction/submit`,
|
|
339
292
|
data: {
|
|
340
|
-
serialized,
|
|
293
|
+
serialized: serializedTx,
|
|
341
294
|
signature,
|
|
342
|
-
},
|
|
295
|
+
} satisfies TransactionSubmitRequest,
|
|
343
296
|
});
|
|
344
297
|
return data;
|
|
345
298
|
}
|
|
346
299
|
|
|
347
|
-
export async function getBalance(
|
|
348
|
-
|
|
349
|
-
partyId: string,
|
|
350
|
-
): Promise<InstrumentBalance[]> {
|
|
351
|
-
const { data } = await gatewayNetwork<InstrumentBalance[]>({
|
|
300
|
+
export async function getBalance(partyId: string): Promise<InstrumentBalance[]> {
|
|
301
|
+
const { data } = await network<InstrumentBalance[]>({
|
|
352
302
|
method: "GET",
|
|
353
|
-
|
|
303
|
+
// TODO: we need better solution ?
|
|
304
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId.replace(/_/g, ":")}/balance`,
|
|
354
305
|
});
|
|
355
306
|
return data;
|
|
356
307
|
}
|
|
357
308
|
|
|
358
|
-
export async function getPartyById(
|
|
359
|
-
return await getParty(
|
|
309
|
+
export async function getPartyById(partyId: string): Promise<PartyInfo> {
|
|
310
|
+
return await getParty(partyId, "party-id");
|
|
360
311
|
}
|
|
361
312
|
|
|
362
|
-
export async function getPartyByPubKey(
|
|
363
|
-
|
|
364
|
-
pubKey: string,
|
|
365
|
-
): Promise<PartyInfo> {
|
|
366
|
-
return await getParty(currency, pubKey, "public-key");
|
|
313
|
+
export async function getPartyByPubKey(pubKey: string): Promise<PartyInfo> {
|
|
314
|
+
return await getParty(pubKey, "public-key");
|
|
367
315
|
}
|
|
368
316
|
|
|
369
|
-
async function getParty(
|
|
370
|
-
|
|
371
|
-
identifier: string,
|
|
372
|
-
by: "party-id" | "public-key",
|
|
373
|
-
): Promise<PartyInfo> {
|
|
374
|
-
const { data } = await gatewayNetwork<PartyInfo>({
|
|
317
|
+
async function getParty(identifier: string, by: "party-id" | "public-key"): Promise<PartyInfo> {
|
|
318
|
+
const { data } = await network<PartyInfo>({
|
|
375
319
|
method: "GET",
|
|
376
|
-
url: `${getGatewayUrl(
|
|
320
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${identifier}?by=${by}`,
|
|
377
321
|
});
|
|
378
322
|
return data;
|
|
379
323
|
}
|
|
380
324
|
|
|
381
325
|
export async function getOperations(
|
|
382
|
-
currency: CryptoCurrency,
|
|
383
326
|
partyId: string,
|
|
384
327
|
options?: {
|
|
385
328
|
cursor?: number | undefined;
|
|
@@ -391,26 +334,26 @@ export async function getOperations(
|
|
|
391
334
|
next: number;
|
|
392
335
|
operations: OperationInfo[];
|
|
393
336
|
}> {
|
|
394
|
-
const { data } = await
|
|
337
|
+
const { data } = await network<{
|
|
395
338
|
next: number;
|
|
396
339
|
operations: OperationInfo[];
|
|
397
340
|
}>({
|
|
398
341
|
method: "GET",
|
|
399
|
-
url: `${getGatewayUrl(
|
|
400
|
-
|
|
342
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId.replace(/_/g, ":")}/operations`,
|
|
343
|
+
data: options,
|
|
401
344
|
});
|
|
402
345
|
return data;
|
|
403
346
|
}
|
|
404
347
|
|
|
405
|
-
type
|
|
348
|
+
type PrepareTapRequestRequest = {
|
|
406
349
|
partyId: string;
|
|
407
350
|
amount?: number;
|
|
408
351
|
};
|
|
409
352
|
|
|
410
|
-
type
|
|
411
|
-
serialized: string;
|
|
353
|
+
type PrepareTapRequestResponse = {
|
|
354
|
+
serialized: "string";
|
|
412
355
|
json: null;
|
|
413
|
-
hash: string;
|
|
356
|
+
hash: "string";
|
|
414
357
|
};
|
|
415
358
|
|
|
416
359
|
enum TransactionType {
|
|
@@ -418,20 +361,13 @@ enum TransactionType {
|
|
|
418
361
|
TRANSFER_PRE_APPROVAL_PROPOSAL = "transfer-pre-approval-proposal",
|
|
419
362
|
}
|
|
420
363
|
|
|
421
|
-
export async function prepareTapRequest(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
): Promise<
|
|
425
|
-
|
|
426
|
-
return {
|
|
427
|
-
serialized: "",
|
|
428
|
-
json: null,
|
|
429
|
-
hash: "",
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
const { data } = await gatewayNetwork<PrepareTapResponse, { amount: number; type: string }>({
|
|
364
|
+
export async function prepareTapRequest({
|
|
365
|
+
partyId,
|
|
366
|
+
amount = 1000000,
|
|
367
|
+
}: PrepareTapRequestRequest): Promise<PrepareTapRequestResponse> {
|
|
368
|
+
const { data } = await network<PrepareTapRequestResponse>({
|
|
433
369
|
method: "POST",
|
|
434
|
-
url: `${getGatewayUrl(
|
|
370
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId}/transaction/prepare`,
|
|
435
371
|
data: {
|
|
436
372
|
amount: parseInt(amount.toString(), 10), // Convert to integer to avoid scientific notation
|
|
437
373
|
type: TransactionType.TAP_REQUEST,
|
|
@@ -451,73 +387,58 @@ type SubmitTapRequestResponse = {
|
|
|
451
387
|
update_id: string;
|
|
452
388
|
};
|
|
453
389
|
|
|
454
|
-
export async function submitTapRequest(
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
Omit<SubmitTapRequestRequest, "partyId">
|
|
461
|
-
>({
|
|
390
|
+
export async function submitTapRequest({
|
|
391
|
+
partyId,
|
|
392
|
+
serialized,
|
|
393
|
+
signature,
|
|
394
|
+
}: SubmitTapRequestRequest): Promise<SubmitTapRequestResponse> {
|
|
395
|
+
const { data } = await network<SubmitTapRequestResponse>({
|
|
462
396
|
method: "POST",
|
|
463
|
-
url: `${getGatewayUrl(
|
|
397
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId}/transaction/submit`,
|
|
464
398
|
data: {
|
|
465
399
|
serialized,
|
|
466
400
|
signature,
|
|
467
|
-
},
|
|
401
|
+
} satisfies Omit<SubmitTapRequestRequest, "partyId">,
|
|
468
402
|
});
|
|
469
403
|
return data;
|
|
470
404
|
}
|
|
471
405
|
|
|
472
|
-
export async function
|
|
473
|
-
|
|
474
|
-
partyId: string,
|
|
475
|
-
params: PrepareTransferRequest,
|
|
476
|
-
): Promise<PrepareTransferResponse> {
|
|
477
|
-
const { data } = await gatewayNetwork<PrepareTransferResponse, PrepareTransferRequest>({
|
|
478
|
-
method: "POST",
|
|
479
|
-
url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/party/${partyId}/transaction/prepare`,
|
|
480
|
-
data: params,
|
|
481
|
-
});
|
|
482
|
-
return data;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
export async function getLedgerEnd(currency: CryptoCurrency): Promise<number> {
|
|
486
|
-
const { data } = await gatewayNetwork<number>({
|
|
406
|
+
export async function getLedgerEnd(): Promise<number> {
|
|
407
|
+
const { data } = await network<number>({
|
|
487
408
|
method: "GET",
|
|
488
|
-
url: `${getGatewayUrl(
|
|
409
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/ledger-end`,
|
|
489
410
|
});
|
|
490
411
|
return data;
|
|
491
412
|
}
|
|
492
413
|
|
|
493
414
|
export async function preparePreApprovalTransaction(
|
|
494
|
-
currency: CryptoCurrency,
|
|
495
415
|
partyId: string,
|
|
496
416
|
): Promise<PrepareTransactionResponse> {
|
|
497
|
-
const { data } = await
|
|
417
|
+
const { data } = await network<PrepareTransactionResponse>({
|
|
498
418
|
method: "POST",
|
|
499
|
-
url: `${getGatewayUrl(
|
|
419
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId}/transaction/prepare`,
|
|
500
420
|
data: {
|
|
501
421
|
type: TransactionType.TRANSFER_PRE_APPROVAL_PROPOSAL,
|
|
502
422
|
receiver: partyId,
|
|
503
|
-
},
|
|
423
|
+
} satisfies PrepareTransactionRequest,
|
|
504
424
|
});
|
|
505
425
|
return data;
|
|
506
426
|
}
|
|
507
427
|
|
|
508
428
|
export async function submitPreApprovalTransaction(
|
|
509
|
-
currency: CryptoCurrency,
|
|
510
429
|
partyId: string,
|
|
511
|
-
|
|
430
|
+
preparedTransaction: PrepareTransactionResponse,
|
|
512
431
|
signature: string,
|
|
513
432
|
): Promise<PreApprovalResult> {
|
|
514
|
-
const
|
|
433
|
+
const submitRequest: SubmitTransactionRequest = {
|
|
434
|
+
serialized: preparedTransaction.serialized,
|
|
435
|
+
signature,
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const { data } = await network<SubmitTransactionResponse>({
|
|
515
439
|
method: "POST",
|
|
516
|
-
url: `${getGatewayUrl(
|
|
517
|
-
data:
|
|
518
|
-
serialized,
|
|
519
|
-
signature,
|
|
520
|
-
},
|
|
440
|
+
url: `${getGatewayUrl()}/v1/node/${getNodeId()}/party/${partyId}/transaction/submit`,
|
|
441
|
+
data: submitRequest,
|
|
521
442
|
});
|
|
522
443
|
|
|
523
444
|
return {
|
package/src/network/node.ts
CHANGED
|
@@ -3,7 +3,7 @@ import network from "@ledgerhq/live-network";
|
|
|
3
3
|
import type { LiveNetworkRequest } from "@ledgerhq/live-network/network";
|
|
4
4
|
import { getEnv } from "@ledgerhq/live-env";
|
|
5
5
|
import coinConfig from "../config";
|
|
6
|
-
import { AccountInfoResponse,
|
|
6
|
+
import { AccountInfoResponse, SubmitReponse } from "./types";
|
|
7
7
|
import crypto from "crypto";
|
|
8
8
|
|
|
9
9
|
const getNodeUrl = () => coinConfig.getCoinConfig().nodeUrl || "";
|
|
@@ -86,10 +86,10 @@ export const getLedgerEnd = async (): Promise<number> => {
|
|
|
86
86
|
return data.offset;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
export const submit = async (signedTx: string): Promise<
|
|
89
|
+
export const submit = async (signedTx: string): Promise<SubmitReponse> => {
|
|
90
90
|
// @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
|
|
91
91
|
const url = `${getEnv("NODE_BOILERPLATE")}/submit`;
|
|
92
|
-
const { data } = await network<
|
|
92
|
+
const { data } = await network<SubmitReponse>({
|
|
93
93
|
url,
|
|
94
94
|
method: "GET",
|
|
95
95
|
});
|
package/src/network/types.ts
CHANGED
package/src/signer/getAddress.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { GetAddressOptions } from "@ledgerhq/coin-framework/derivation";
|
|
2
2
|
import { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
|
3
3
|
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
4
|
-
import { CantonSigner
|
|
4
|
+
import { CantonSigner } from "../types";
|
|
5
5
|
|
|
6
6
|
const getAddress = (signerContext: SignerContext<CantonSigner>): GetAddressFn => {
|
|
7
|
-
return async (deviceId: string, { path
|
|
8
|
-
const { address, publicKey } = await signerContext(deviceId, signer =>
|
|
9
|
-
signer.getAddress(path, verify),
|
|
10
|
-
);
|
|
7
|
+
return async (deviceId: string, { path }: GetAddressOptions) => {
|
|
8
|
+
const { address, publicKey } = await signerContext(deviceId, signer => signer.getAddress(path));
|
|
11
9
|
|
|
12
10
|
return {
|
|
13
11
|
path,
|
|
14
12
|
address,
|
|
15
13
|
publicKey,
|
|
16
|
-
}
|
|
14
|
+
};
|
|
17
15
|
};
|
|
18
16
|
};
|
|
19
17
|
|
package/src/types/bridge.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { BigNumber } from "bignumber.js";
|
|
2
2
|
import type { Observable } from "rxjs";
|
|
3
3
|
import type {
|
|
4
|
-
Account,
|
|
5
|
-
AccountRaw,
|
|
6
4
|
CurrencyBridge,
|
|
7
5
|
TransactionCommon,
|
|
8
6
|
TransactionCommonRaw,
|
|
@@ -15,16 +13,13 @@ import type {
|
|
|
15
13
|
CantonPreApprovalProgress,
|
|
16
14
|
CantonPreApprovalResult,
|
|
17
15
|
} from "./onboard";
|
|
18
|
-
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
19
16
|
|
|
20
17
|
export interface CantonCurrencyBridge extends CurrencyBridge {
|
|
21
18
|
onboardAccount: (
|
|
22
|
-
currency: CryptoCurrency,
|
|
23
19
|
deviceId: string,
|
|
24
20
|
derivationPath: string,
|
|
25
21
|
) => Observable<CantonOnboardProgress | CantonOnboardResult>;
|
|
26
22
|
authorizePreapproval: (
|
|
27
|
-
currency: CryptoCurrency,
|
|
28
23
|
deviceId: string,
|
|
29
24
|
derivationPath: string,
|
|
30
25
|
partyId: string,
|
|
@@ -46,28 +41,12 @@ export type NetworkInfoRaw = {
|
|
|
46
41
|
export type Transaction = TransactionCommon & {
|
|
47
42
|
family: "canton";
|
|
48
43
|
fee: BigNumber | null | undefined;
|
|
49
|
-
memo?: string;
|
|
50
44
|
};
|
|
51
45
|
|
|
52
46
|
export type TransactionRaw = TransactionCommonRaw & {
|
|
53
47
|
family: "canton";
|
|
54
48
|
fee: string | null | undefined;
|
|
55
|
-
memo?: string;
|
|
56
49
|
};
|
|
57
50
|
|
|
58
51
|
export type TransactionStatus = TransactionStatusCommon;
|
|
59
52
|
export type TransactionStatusRaw = TransactionStatusCommonRaw;
|
|
60
|
-
|
|
61
|
-
export type CantonResources = {
|
|
62
|
-
partyId: string;
|
|
63
|
-
};
|
|
64
|
-
export type CantonResourcesRaw = {
|
|
65
|
-
partyId: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type CantonAccount = Account & {
|
|
69
|
-
cantonResources?: CantonResources;
|
|
70
|
-
};
|
|
71
|
-
export type CantonAccountRaw = AccountRaw & {
|
|
72
|
-
cantonResources: CantonResourcesRaw;
|
|
73
|
-
};
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
export * from "./bridge";
|
|
2
2
|
export * from "./onboard";
|
|
3
3
|
export * from "./signer";
|
|
4
|
+
|
|
5
|
+
export type BoilerplateNativeTransaction = {
|
|
6
|
+
TransactionType: "Payment";
|
|
7
|
+
Account: string;
|
|
8
|
+
Amount: string;
|
|
9
|
+
Destination: string;
|
|
10
|
+
Fee: string;
|
|
11
|
+
Sequence: number;
|
|
12
|
+
SigningPubKey?: string;
|
|
13
|
+
TxnSignature?: string;
|
|
14
|
+
};
|
package/src/types/onboard.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Account } from "@ledgerhq/types-live";
|
|
2
|
-
|
|
3
1
|
export enum OnboardStatus {
|
|
4
2
|
INIT,
|
|
5
3
|
PREPARE,
|
|
@@ -24,7 +22,6 @@ export type CantonOnboardProgress = {
|
|
|
24
22
|
|
|
25
23
|
export type CantonOnboardResult = {
|
|
26
24
|
partyId: string;
|
|
27
|
-
account: Partial<Account>;
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
export type CantonPreApprovalProgress = {
|
package/src/types/signer.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export type CantonAddress = {
|
|
2
2
|
publicKey: string;
|
|
3
3
|
address: string;
|
|
4
|
-
path: string; // TODO: check if necessary
|
|
5
4
|
};
|
|
6
5
|
|
|
7
6
|
export type CantonSignature = string; // `0x${string}`
|
|
8
7
|
|
|
9
8
|
export interface CantonSigner {
|
|
10
|
-
getAddress(path: string
|
|
9
|
+
getAddress(path: string): Promise<CantonAddress>;
|
|
11
10
|
signTransaction(path: string, rawTx: string): Promise<CantonSignature>;
|
|
12
11
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Account, AccountRaw } from "@ledgerhq/types-live";
|
|
2
|
-
export declare function assignToAccountRaw(account: Account, accountRaw: AccountRaw): void;
|
|
3
|
-
export declare function assignFromAccountRaw(accountRaw: AccountRaw, account: Account): void;
|
|
4
|
-
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/bridge/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAqBhE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAMjF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAMnF"}
|