@ledgerhq/coin-aptos 3.2.0 → 3.3.0-nightly.1
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 +21 -0
- package/lib/__tests__/api/craftTransaction.unit.test.js +4 -4
- package/lib/__tests__/api/craftTransaction.unit.test.js.map +1 -1
- package/lib/__tests__/api/index.integ.test.js +6 -4
- package/lib/__tests__/api/index.integ.test.js.map +1 -1
- package/lib/__tests__/network/client.test.js +2 -2
- package/lib/__tests__/network/client.test.js.map +1 -1
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +1 -1
- package/lib/api/index.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts +2 -2
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +1 -1
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/network/client.d.ts +2 -2
- package/lib/network/client.d.ts.map +1 -1
- package/lib/network/client.js +2 -2
- package/lib/network/client.js.map +1 -1
- package/lib-es/__tests__/api/craftTransaction.unit.test.js +4 -4
- package/lib-es/__tests__/api/craftTransaction.unit.test.js.map +1 -1
- package/lib-es/__tests__/api/index.integ.test.js +6 -4
- package/lib-es/__tests__/api/index.integ.test.js.map +1 -1
- package/lib-es/__tests__/network/client.test.js +2 -2
- package/lib-es/__tests__/network/client.test.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +1 -1
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts +2 -2
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +1 -1
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/network/client.d.ts +2 -2
- package/lib-es/network/client.d.ts.map +1 -1
- package/lib-es/network/client.js +2 -2
- package/lib-es/network/client.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/api/craftTransaction.unit.test.ts +4 -4
- package/src/__tests__/api/index.integ.test.ts +6 -4
- package/src/__tests__/network/client.test.ts +2 -2
- package/src/api/index.ts +4 -3
- package/src/logic/craftTransaction.ts +3 -3
- package/src/network/client.ts +2 -3
|
@@ -860,7 +860,7 @@ describe("Aptos API", () => {
|
|
|
860
860
|
it("list of operations", async () => {
|
|
861
861
|
const api = new AptosAPI("aptos");
|
|
862
862
|
const address = "0x12345";
|
|
863
|
-
const pagination: Pagination = { minHeight: 0 };
|
|
863
|
+
const pagination: Pagination = { minHeight: 0, order: "asc" };
|
|
864
864
|
|
|
865
865
|
const txs: AptosTransaction[] = [
|
|
866
866
|
{
|
|
@@ -1297,7 +1297,7 @@ describe("Aptos API", () => {
|
|
|
1297
1297
|
|
|
1298
1298
|
api.getAccountInfo = jest.fn().mockResolvedValue({ transactions });
|
|
1299
1299
|
|
|
1300
|
-
const ops = await api.listOperations(address, pagination);
|
|
1300
|
+
const ops = await api.listOperations(address, pagination.minHeight);
|
|
1301
1301
|
|
|
1302
1302
|
expect(ops[0]).toHaveLength(2);
|
|
1303
1303
|
expect(ops[1]).toBe("");
|
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
AlpacaApi,
|
|
3
3
|
Block,
|
|
4
4
|
BlockInfo,
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
Stake,
|
|
7
7
|
Reward,
|
|
8
8
|
Page,
|
|
9
|
+
CraftedTransaction,
|
|
9
10
|
} from "@ledgerhq/coin-framework/api/index";
|
|
10
11
|
import type { AptosConfig as AptosConfigApi } from "../config";
|
|
11
12
|
import type { Balance, Pagination, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
|
|
@@ -23,13 +24,13 @@ export function createApi(config: AptosConfigApi): AlpacaApi {
|
|
|
23
24
|
return {
|
|
24
25
|
broadcast: (tx: string) => client.broadcast(tx),
|
|
25
26
|
combine: (tx, signature, pubkey): string => combine(tx, signature, pubkey),
|
|
26
|
-
craftTransaction: (transactionIntent, _customFees): Promise<
|
|
27
|
+
craftTransaction: (transactionIntent, _customFees): Promise<CraftedTransaction> =>
|
|
27
28
|
craftTransaction(client, transactionIntent),
|
|
28
29
|
estimateFees: (transactionIntent: TransactionIntent) => client.estimateFees(transactionIntent),
|
|
29
30
|
getBalance: (address): Promise<Balance[]> => getBalances(client, address),
|
|
30
31
|
lastBlock: () => client.getLastBlock(),
|
|
31
32
|
listOperations: (address: string, pagination: Pagination) =>
|
|
32
|
-
client.listOperations(address, pagination),
|
|
33
|
+
client.listOperations(address, pagination.minHeight),
|
|
33
34
|
getBlock(_height): Promise<Block> {
|
|
34
35
|
throw new Error("getBlock is not supported");
|
|
35
36
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CraftedTransaction, TransactionIntent } from "@ledgerhq/coin-framework/lib/api/types";
|
|
2
2
|
import type { Account, TokenAccount } from "@ledgerhq/types-live";
|
|
3
3
|
import type { AptosAPI } from "../network";
|
|
4
4
|
import buildTransaction, { isTokenType } from "./buildTransaction";
|
|
@@ -10,7 +10,7 @@ import type { AptosBalance } from "../types";
|
|
|
10
10
|
export async function craftTransaction(
|
|
11
11
|
aptosClient: AptosAPI,
|
|
12
12
|
transactionIntent: TransactionIntent,
|
|
13
|
-
): Promise<
|
|
13
|
+
): Promise<CraftedTransaction> {
|
|
14
14
|
const newTx = createTransaction();
|
|
15
15
|
newTx.amount = BigNumber(transactionIntent.amount.toString());
|
|
16
16
|
newTx.recipient = transactionIntent.recipient;
|
|
@@ -50,7 +50,7 @@ export async function craftTransaction(
|
|
|
50
50
|
tokenType ?? undefined,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
return aptosTx.bcsToHex().toString();
|
|
53
|
+
return { transaction: aptosTx.bcsToHex().toString() };
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function getContractAddress(txIntent: TransactionIntent): string {
|
package/src/network/client.ts
CHANGED
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
BlockInfo,
|
|
47
47
|
FeeEstimation,
|
|
48
48
|
Operation,
|
|
49
|
-
Pagination,
|
|
50
49
|
TransactionIntent,
|
|
51
50
|
} from "@ledgerhq/coin-framework/api/types";
|
|
52
51
|
import { log } from "@ledgerhq/logs";
|
|
@@ -290,9 +289,9 @@ export class AptosAPI {
|
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
291
|
|
|
293
|
-
async listOperations(rawAddress: string,
|
|
292
|
+
async listOperations(rawAddress: string, minHeight: number): Promise<[Operation[], string]> {
|
|
294
293
|
const address = normalizeAddress(rawAddress);
|
|
295
|
-
const transactions = await this.getAccountInfo(address,
|
|
294
|
+
const transactions = await this.getAccountInfo(address, minHeight.toString());
|
|
296
295
|
const newOperations = transactionsToOperations(address, transactions.transactions);
|
|
297
296
|
|
|
298
297
|
return [newOperations, ""];
|