@ledgerhq/coin-aptos 3.5.0-nightly.7 → 3.6.0-nightly.20251107095716
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 +33 -52
- package/lib/bridge/logic.d.ts.map +1 -1
- package/lib/bridge/logic.js +2 -2
- package/lib/bridge/logic.js.map +1 -1
- package/lib/bridge/signOperation.js +1 -1
- package/lib/bridge/signOperation.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/network/client.d.ts +1 -0
- package/lib/network/client.d.ts.map +1 -1
- package/lib/network/client.js +34 -14
- package/lib/network/client.js.map +1 -1
- package/lib/network/graphql/queries.d.ts.map +1 -1
- package/lib/network/graphql/queries.js +8 -3
- package/lib/network/graphql/queries.js.map +1 -1
- package/lib/network/graphql/types.d.ts +4 -0
- package/lib/network/graphql/types.d.ts.map +1 -1
- package/lib-es/bridge/logic.d.ts.map +1 -1
- package/lib-es/bridge/logic.js +3 -3
- package/lib-es/bridge/logic.js.map +1 -1
- package/lib-es/bridge/signOperation.js +1 -1
- package/lib-es/bridge/signOperation.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/network/client.d.ts +1 -0
- package/lib-es/network/client.d.ts.map +1 -1
- package/lib-es/network/client.js +34 -14
- package/lib-es/network/client.js.map +1 -1
- package/lib-es/network/graphql/queries.d.ts.map +1 -1
- package/lib-es/network/graphql/queries.js +8 -3
- package/lib-es/network/graphql/queries.js.map +1 -1
- package/lib-es/network/graphql/types.d.ts +4 -0
- package/lib-es/network/graphql/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/__tests__/bridge/logic.test.ts +7 -7
- package/src/__tests__/bridge/signOperation.test.ts +4 -4
- package/src/__tests__/bridge/synchronisation.test.ts +18 -18
- package/src/__tests__/logic/processRecipients.unit.test.ts +1 -1
- package/src/api/index.ts +1 -1
- package/src/bridge/logic.ts +9 -3
- package/src/bridge/signOperation.ts +1 -1
- package/src/constants.ts +1 -0
- package/src/network/client.ts +42 -17
- package/src/network/graphql/queries.ts +8 -3
- package/src/network/graphql/types.ts +5 -0
package/src/network/client.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { GetAccountTransactionsData, GetAccountTransactionsDataGt } from "./grap
|
|
|
41
41
|
import type {
|
|
42
42
|
GetAccountTransactionsDataQuery,
|
|
43
43
|
GetAccountTransactionsDataGtQueryVariables,
|
|
44
|
+
TransactionVersion,
|
|
44
45
|
} from "./graphql/types";
|
|
45
46
|
import {
|
|
46
47
|
BlockInfo,
|
|
@@ -297,31 +298,55 @@ export class AptosAPI {
|
|
|
297
298
|
return [newOperations, ""];
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
private async
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
301
|
+
private async getAllTransactions(address: string, gt?: string): Promise<TransactionVersion[]> {
|
|
302
|
+
let allTransactions: TransactionVersion[] = [];
|
|
303
|
+
let offset = 0;
|
|
304
304
|
|
|
305
305
|
let query = GetAccountTransactionsData;
|
|
306
306
|
if (gt) {
|
|
307
307
|
query = GetAccountTransactionsDataGt;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
310
|
+
const condition = true;
|
|
311
|
+
|
|
312
|
+
while (condition) {
|
|
313
|
+
try {
|
|
314
|
+
const queryResponse = await this.apolloClient.query<
|
|
315
|
+
GetAccountTransactionsDataQuery,
|
|
316
|
+
GetAccountTransactionsDataGtQueryVariables
|
|
317
|
+
>({
|
|
318
|
+
query,
|
|
319
|
+
variables: {
|
|
320
|
+
address,
|
|
321
|
+
limit: 100,
|
|
322
|
+
gt,
|
|
323
|
+
offset,
|
|
324
|
+
},
|
|
325
|
+
fetchPolicy: "network-only",
|
|
326
|
+
});
|
|
327
|
+
offset += 100;
|
|
328
|
+
|
|
329
|
+
allTransactions = allTransactions.concat(queryResponse.data.account_transactions);
|
|
330
|
+
|
|
331
|
+
if (queryResponse.data.account_transactions.length < 100) {
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
} catch (error: any) {
|
|
335
|
+
throw new Error(error);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return allTransactions;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private async fetchTransactions(address: string, gt?: string) {
|
|
343
|
+
if (!address) {
|
|
344
|
+
return [];
|
|
345
|
+
}
|
|
322
346
|
|
|
347
|
+
const transactions = await this.getAllTransactions(address, gt);
|
|
323
348
|
return Promise.all(
|
|
324
|
-
|
|
349
|
+
transactions
|
|
325
350
|
.slice()
|
|
326
351
|
.sort((a, b) => b.transaction_version - a.transaction_version)
|
|
327
352
|
.map(({ transaction_version }) => {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { gql } from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
export const GetAccountTransactionsData = gql`
|
|
4
|
-
query GetAccountTransactionsData($address: String, $limit: Int) {
|
|
5
|
-
account_transactions(
|
|
4
|
+
query GetAccountTransactionsData($address: String, $limit: Int, $offset: Int) {
|
|
5
|
+
account_transactions(
|
|
6
|
+
where: { account_address: { _eq: $address } }
|
|
7
|
+
limit: $limit
|
|
8
|
+
offset: $offset
|
|
9
|
+
) {
|
|
6
10
|
transaction_version
|
|
7
11
|
__typename
|
|
8
12
|
}
|
|
@@ -10,10 +14,11 @@ export const GetAccountTransactionsData = gql`
|
|
|
10
14
|
`;
|
|
11
15
|
|
|
12
16
|
export const GetAccountTransactionsDataGt = gql`
|
|
13
|
-
query GetAccountTransactionsDataGt($address: String, $limit: Int, $gt: bigint) {
|
|
17
|
+
query GetAccountTransactionsDataGt($address: String, $limit: Int, $gt: bigint, $offset: Int) {
|
|
14
18
|
account_transactions(
|
|
15
19
|
where: { account_address: { _eq: $address }, transaction_version: { _gt: $gt } }
|
|
16
20
|
limit: $limit
|
|
21
|
+
offset: $offset
|
|
17
22
|
) {
|
|
18
23
|
transaction_version
|
|
19
24
|
__typename
|
|
@@ -24,6 +24,7 @@ export type GetAccountTransactionsDataQuery = {
|
|
|
24
24
|
export type GetAccountTransactionsDataGtQueryVariables = Exact<{
|
|
25
25
|
address?: InputMaybe<Scalars["String"]>;
|
|
26
26
|
limit?: InputMaybe<Scalars["Int"]>;
|
|
27
|
+
offset?: InputMaybe<Scalars["Int"]>;
|
|
27
28
|
gt?: InputMaybe<Scalars["bigint"]>;
|
|
28
29
|
}>;
|
|
29
30
|
|
|
@@ -82,3 +83,7 @@ export interface CurrentDelegatorBalance {
|
|
|
82
83
|
current_pool_balance: CurrentPoolBalance;
|
|
83
84
|
staking_pool_metadata: StakingPoolMetadata;
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
export type TransactionVersion = {
|
|
88
|
+
transaction_version: number;
|
|
89
|
+
};
|