@ledgerhq/live-common 21.36.0 → 21.36.3
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/lib/bridge/jsHelpers.d.ts.map +1 -1
- package/lib/bridge/jsHelpers.js +238 -245
- package/lib/bridge/jsHelpers.js.map +1 -1
- package/lib/exchange/swap/getCompleteSwapHistory.js +17 -14
- package/lib/exchange/swap/getCompleteSwapHistory.js.map +1 -1
- package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-signOperation.js +130 -139
- package/lib/families/bitcoin/js-signOperation.js.map +1 -1
- package/lib/families/crypto_org/js-signOperation.d.ts.map +1 -1
- package/lib/families/crypto_org/js-signOperation.js +55 -62
- package/lib/families/crypto_org/js-signOperation.js.map +1 -1
- package/lib/families/elrond/js-signOperation.d.ts.map +1 -1
- package/lib/families/elrond/js-signOperation.js +43 -50
- package/lib/families/elrond/js-signOperation.js.map +1 -1
- package/lib/families/polkadot/js-signOperation.d.ts.map +1 -1
- package/lib/families/polkadot/js-signOperation.js +54 -61
- package/lib/families/polkadot/js-signOperation.js.map +1 -1
- package/lib/families/ripple/bridge/js.d.ts.map +1 -1
- package/lib/families/ripple/bridge/js.js +299 -313
- package/lib/families/ripple/bridge/js.js.map +1 -1
- package/lib/families/stellar/js-signOperation.d.ts.map +1 -1
- package/lib/families/stellar/js-signOperation.js +44 -51
- package/lib/families/stellar/js-signOperation.js.map +1 -1
- package/lib/families/tron/bridge/js.d.ts.map +1 -1
- package/lib/families/tron/bridge/js.js +159 -167
- package/lib/families/tron/bridge/js.js.map +1 -1
- package/lib/notifications/AnnouncementProvider/machine.d.ts +21 -4
- package/lib/notifications/AnnouncementProvider/machine.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/machine.d.ts +21 -4
- package/lib/notifications/ServiceStatusProvider/machine.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/.DS_Store +0 -0
- package/src/bridge/jsHelpers.ts +213 -213
- package/src/data/flags/.DS_Store +0 -0
- package/src/exchange/swap/getCompleteSwapHistory.ts +1 -1
- package/src/families/bitcoin/js-signOperation.ts +14 -17
- package/src/families/crypto_org/js-signOperation.ts +12 -16
- package/src/families/elrond/js-signOperation.ts +10 -14
- package/src/families/polkadot/js-signOperation.ts +61 -61
- package/src/families/ripple/bridge/js.ts +257 -260
- package/src/families/stellar/js-signOperation.ts +10 -14
- package/src/families/tron/bridge/js.ts +57 -58
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
OperationType,
|
|
12
12
|
SignOperationEvent,
|
|
13
13
|
} from "../../types";
|
|
14
|
-
import {
|
|
14
|
+
import { withDevice } from "../../hw/deviceAccess";
|
|
15
15
|
import { encodeOperationId } from "../../operation";
|
|
16
16
|
import { buildTransaction } from "./js-buildTransaction";
|
|
17
17
|
import { calculateAmount, getNonce, isFirstBond } from "./logic";
|
|
@@ -157,69 +157,69 @@ const signOperation = ({
|
|
|
157
157
|
deviceId: any;
|
|
158
158
|
transaction: Transaction;
|
|
159
159
|
}): Observable<SignOperationEvent> =>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
160
|
+
withDevice(deviceId)(
|
|
161
|
+
(transport) =>
|
|
162
|
+
new Observable((o) => {
|
|
163
|
+
async function main() {
|
|
164
|
+
o.next({
|
|
165
|
+
type: "device-signature-requested",
|
|
166
|
+
});
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
if (!transaction.fees) {
|
|
169
|
+
throw new FeeNotLoaded();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Ensure amount is filled when useAllAmount
|
|
173
|
+
const transactionToSign = {
|
|
174
|
+
...transaction,
|
|
175
|
+
amount: calculateAmount({
|
|
176
|
+
a: account,
|
|
177
|
+
t: transaction,
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
const { unsigned, registry } = await buildTransaction(
|
|
181
|
+
account,
|
|
182
|
+
transactionToSign,
|
|
183
|
+
true
|
|
184
|
+
);
|
|
185
|
+
const payload = registry
|
|
186
|
+
.createType("ExtrinsicPayload", unsigned, {
|
|
187
|
+
version: unsigned.version,
|
|
188
|
+
})
|
|
189
|
+
.toU8a({
|
|
190
|
+
method: true,
|
|
191
|
+
});
|
|
192
|
+
// Sign by device
|
|
193
|
+
const polkadot = new Polkadot(transport);
|
|
194
|
+
// FIXME: the type of payload Uint8Array is not compatible with the signature of sign which accept a string
|
|
195
|
+
const r = await polkadot.sign(
|
|
196
|
+
account.freshAddressPath,
|
|
197
|
+
payload as any
|
|
198
|
+
);
|
|
199
|
+
const signed = await signExtrinsic(unsigned, r.signature, registry);
|
|
200
|
+
o.next({
|
|
201
|
+
type: "device-signature-granted",
|
|
202
|
+
});
|
|
203
|
+
const operation = buildOptimisticOperation(
|
|
204
|
+
account,
|
|
205
|
+
transactionToSign,
|
|
206
|
+
transactionToSign.fees ?? new BigNumber(0)
|
|
207
|
+
);
|
|
208
|
+
o.next({
|
|
209
|
+
type: "signed",
|
|
210
|
+
signedOperation: {
|
|
211
|
+
operation,
|
|
212
|
+
signature: signed,
|
|
213
|
+
expirationDate: null,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
171
216
|
}
|
|
172
217
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
amount: calculateAmount({
|
|
177
|
-
a: account,
|
|
178
|
-
t: transaction,
|
|
179
|
-
}),
|
|
180
|
-
};
|
|
181
|
-
const { unsigned, registry } = await buildTransaction(
|
|
182
|
-
account,
|
|
183
|
-
transactionToSign,
|
|
184
|
-
true
|
|
185
|
-
);
|
|
186
|
-
const payload = registry
|
|
187
|
-
.createType("ExtrinsicPayload", unsigned, {
|
|
188
|
-
version: unsigned.version,
|
|
189
|
-
})
|
|
190
|
-
.toU8a({
|
|
191
|
-
method: true,
|
|
192
|
-
});
|
|
193
|
-
// Sign by device
|
|
194
|
-
const polkadot = new Polkadot(transport);
|
|
195
|
-
// FIXME: the type of payload Uint8Array is not compatible with the signature of sign which accept a string
|
|
196
|
-
const r = await polkadot.sign(account.freshAddressPath, payload as any);
|
|
197
|
-
const signed = await signExtrinsic(unsigned, r.signature, registry);
|
|
198
|
-
o.next({
|
|
199
|
-
type: "device-signature-granted",
|
|
200
|
-
});
|
|
201
|
-
const operation = buildOptimisticOperation(
|
|
202
|
-
account,
|
|
203
|
-
transactionToSign,
|
|
204
|
-
transactionToSign.fees ?? new BigNumber(0)
|
|
218
|
+
main().then(
|
|
219
|
+
() => o.complete(),
|
|
220
|
+
(e) => o.error(e)
|
|
205
221
|
);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
signedOperation: {
|
|
209
|
-
operation,
|
|
210
|
-
signature: signed,
|
|
211
|
-
expirationDate: null,
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
} finally {
|
|
215
|
-
close(transport, deviceId);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
main().then(
|
|
220
|
-
() => o.complete(),
|
|
221
|
-
(e) => o.error(e)
|
|
222
|
-
);
|
|
223
|
-
});
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
224
|
|
|
225
225
|
export default signOperation;
|