Comparing version 1.17.0 to 1.18.0
@@ -7,2 +7,8 @@ # Aptos TS SDK Changelog | ||
## 1.18.0 (2023-08-10) | ||
- Fix default behavior for coin client to transfer and create account by default | ||
- Filter amount > 0 on `getTokenOwnersData` | ||
- Include missing fields for all Indexer queries | ||
## 1.17.0 (2023-08-04) | ||
@@ -23,2 +29,5 @@ | ||
- Add support for local/custom networks without an indexer client | ||
- Move to use `account_transactions` query in `getAccountTransactionsData` on `IndexerClient` | ||
- Move to use `account_transaction_aggregate` query in `getAccountTransactionsCount` on `IndexerClient` | ||
- Optional `startVersion` argument on `getUserTransactions` is not positional and part of the object param | ||
@@ -25,0 +34,0 @@ ## 1.15.0 (2023-07-28) |
@@ -89,3 +89,3 @@ { | ||
}, | ||
"version": "1.17.0" | ||
"version": "1.18.0" | ||
} |
@@ -424,3 +424,3 @@ // Copyright © Aptos Foundation | ||
if (tokenVal === "string") { | ||
return stringStructTag; | ||
return new TypeTagStruct(stringStructTag); | ||
} | ||
@@ -427,0 +427,0 @@ if (tokenTy === "IDENT" && (tokenVal.startsWith("0x") || tokenVal.startsWith("0X"))) { |
import * as Types from './types'; | ||
export type CurrentTokenOwnershipFieldsFragment = { __typename?: 'current_token_ownerships_v2', token_standard: string, is_fungible_v2?: boolean | null, is_soulbound_v2?: boolean | null, property_version_v1: any, table_type_v1?: string | null, token_properties_mutated_v1?: any | null, amount: any, last_transaction_timestamp: any, last_transaction_version: any, storage_id: string, owner_address: string, current_token_data?: { __typename?: 'current_token_datas_v2', token_name: string, token_data_id: string, token_uri: string, token_properties: any, supply: any, maximum?: any | null, last_transaction_version: any, last_transaction_timestamp: any, largest_property_version_v1?: any | null, current_collection?: { __typename?: 'current_collections_v2', collection_name: string, creator_address: string, description: string, uri: string, collection_id: string, last_transaction_version: any, current_supply: any, mutable_description?: boolean | null, total_minted_v2?: any | null, table_handle_v1?: string | null, mutable_uri?: boolean | null } | null } | null }; | ||
export type CurrentTokenOwnershipFieldsFragment = { __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }; | ||
@@ -12,3 +12,3 @@ export type GetAccountCoinsDataQueryVariables = Types.Exact<{ | ||
export type GetAccountCoinsDataQuery = { __typename?: 'query_root', current_coin_balances: Array<{ __typename?: 'current_coin_balances', amount: any, coin_type: string, coin_info?: { __typename?: 'coin_infos', name: string, decimals: number, symbol: string } | null }> }; | ||
export type GetAccountCoinsDataQuery = { __typename?: 'query_root', current_coin_balances: Array<{ __typename?: 'current_coin_balances', amount: any, coin_type: string, coin_type_hash: string, last_transaction_timestamp: any, last_transaction_version: any, owner_address: string, coin_info?: { __typename?: 'coin_infos', coin_type: string, coin_type_hash: string, creator_address: string, decimals: number, name: string, supply_aggregator_table_handle?: string | null, supply_aggregator_table_key?: string | null, symbol: string, transaction_created_timestamp: any, transaction_version_created: any } | null }> }; | ||
@@ -42,12 +42,13 @@ export type GetAccountCurrentTokensQueryVariables = Types.Exact<{ | ||
export type GetAccountTransactionsCountQuery = { __typename?: 'query_root', move_resources_aggregate: { __typename?: 'move_resources_aggregate', aggregate?: { __typename?: 'move_resources_aggregate_fields', count: number } | null } }; | ||
export type GetAccountTransactionsCountQuery = { __typename?: 'query_root', account_transactions_aggregate: { __typename?: 'account_transactions_aggregate', aggregate?: { __typename?: 'account_transactions_aggregate_fields', count: number } | null } }; | ||
export type GetAccountTransactionsDataQueryVariables = Types.Exact<{ | ||
address?: Types.InputMaybe<Types.Scalars['String']>; | ||
where_condition: Types.Account_Transactions_Bool_Exp; | ||
offset?: Types.InputMaybe<Types.Scalars['Int']>; | ||
limit?: Types.InputMaybe<Types.Scalars['Int']>; | ||
offset?: Types.InputMaybe<Types.Scalars['Int']>; | ||
order_by?: Types.InputMaybe<Array<Types.Account_Transactions_Order_By> | Types.Account_Transactions_Order_By>; | ||
}>; | ||
export type GetAccountTransactionsDataQuery = { __typename?: 'query_root', move_resources: Array<{ __typename?: 'move_resources', transaction_version: any }> }; | ||
export type GetAccountTransactionsDataQuery = { __typename?: 'query_root', account_transactions: Array<{ __typename?: 'account_transactions', transaction_version: any, account_address: string, token_activities_v2: Array<{ __typename?: 'token_activities_v2', after_value?: string | null, before_value?: string | null, entry_function_id_str?: string | null, event_account_address: string, event_index: any, from_address?: string | null, is_fungible_v2?: boolean | null, property_version_v1: any, to_address?: string | null, token_amount: any, token_data_id: string, token_standard: string, transaction_timestamp: any, transaction_version: any, type: string }> }> }; | ||
@@ -62,3 +63,3 @@ export type GetCollectionDataQueryVariables = Types.Exact<{ | ||
export type GetCollectionDataQuery = { __typename?: 'query_root', current_collections_v2: Array<{ __typename?: 'current_collections_v2', collection_id: string, token_standard: string, collection_name: string, creator_address: string, current_supply: any, description: string, uri: string }> }; | ||
export type GetCollectionDataQuery = { __typename?: 'query_root', current_collections_v2: Array<{ __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string }> }; | ||
@@ -73,3 +74,3 @@ export type GetCollectionsWithOwnedTokensQueryVariables = Types.Exact<{ | ||
export type GetCollectionsWithOwnedTokensQuery = { __typename?: 'query_root', current_collection_ownership_v2_view: Array<{ __typename?: 'current_collection_ownership_v2_view', distinct_tokens?: any | null, last_transaction_version?: any | null, current_collection?: { __typename?: 'current_collections_v2', creator_address: string, collection_name: string, token_standard: string, collection_id: string, description: string, table_handle_v1?: string | null, uri: string, total_minted_v2?: any | null, max_supply?: any | null } | null }> }; | ||
export type GetCollectionsWithOwnedTokensQuery = { __typename?: 'query_root', current_collection_ownership_v2_view: Array<{ __typename?: 'current_collection_ownership_v2_view', collection_id?: string | null, collection_name?: string | null, collection_uri?: string | null, creator_address?: string | null, distinct_tokens?: any | null, last_transaction_version?: any | null, owner_address?: string | null, single_token_uri?: string | null, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, mutable_description?: boolean | null, max_supply?: any | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null }> }; | ||
@@ -94,3 +95,3 @@ export type GetDelegatedStakingActivitiesQueryVariables = Types.Exact<{ | ||
export type GetNumberOfDelegatorsQuery = { __typename?: 'query_root', num_active_delegator_per_pool: Array<{ __typename?: 'num_active_delegator_per_pool', num_active_delegator?: any | null }> }; | ||
export type GetNumberOfDelegatorsQuery = { __typename?: 'query_root', num_active_delegator_per_pool: Array<{ __typename?: 'num_active_delegator_per_pool', num_active_delegator?: any | null, pool_address?: string | null }> }; | ||
@@ -105,3 +106,3 @@ export type GetOwnedTokensQueryVariables = Types.Exact<{ | ||
export type GetOwnedTokensQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, is_fungible_v2?: boolean | null, is_soulbound_v2?: boolean | null, property_version_v1: any, table_type_v1?: string | null, token_properties_mutated_v1?: any | null, amount: any, last_transaction_timestamp: any, last_transaction_version: any, storage_id: string, owner_address: string, current_token_data?: { __typename?: 'current_token_datas_v2', token_name: string, token_data_id: string, token_uri: string, token_properties: any, supply: any, maximum?: any | null, last_transaction_version: any, last_transaction_timestamp: any, largest_property_version_v1?: any | null, current_collection?: { __typename?: 'current_collections_v2', collection_name: string, creator_address: string, description: string, uri: string, collection_id: string, last_transaction_version: any, current_supply: any, mutable_description?: boolean | null, total_minted_v2?: any | null, table_handle_v1?: string | null, mutable_uri?: boolean | null } | null } | null }> }; | ||
export type GetOwnedTokensQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }> }; | ||
@@ -116,3 +117,3 @@ export type GetOwnedTokensByTokenDataQueryVariables = Types.Exact<{ | ||
export type GetOwnedTokensByTokenDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, is_fungible_v2?: boolean | null, is_soulbound_v2?: boolean | null, property_version_v1: any, table_type_v1?: string | null, token_properties_mutated_v1?: any | null, amount: any, last_transaction_timestamp: any, last_transaction_version: any, storage_id: string, owner_address: string, current_token_data?: { __typename?: 'current_token_datas_v2', token_name: string, token_data_id: string, token_uri: string, token_properties: any, supply: any, maximum?: any | null, last_transaction_version: any, last_transaction_timestamp: any, largest_property_version_v1?: any | null, current_collection?: { __typename?: 'current_collections_v2', collection_name: string, creator_address: string, description: string, uri: string, collection_id: string, last_transaction_version: any, current_supply: any, mutable_description?: boolean | null, total_minted_v2?: any | null, table_handle_v1?: string | null, mutable_uri?: boolean | null } | null } | null }> }; | ||
export type GetOwnedTokensByTokenDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }> }; | ||
@@ -144,3 +145,3 @@ export type GetTokenActivitiesQueryVariables = Types.Exact<{ | ||
export type GetTokenCurrentOwnerDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', owner_address: string }> }; | ||
export type GetTokenCurrentOwnerDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }> }; | ||
@@ -155,3 +156,3 @@ export type GetTokenDataQueryVariables = Types.Exact<{ | ||
export type GetTokenDataQuery = { __typename?: 'query_root', current_token_datas_v2: Array<{ __typename?: 'current_token_datas_v2', token_data_id: string, token_name: string, token_uri: string, token_properties: any, token_standard: string, largest_property_version_v1?: any | null, maximum?: any | null, is_fungible_v2?: boolean | null, supply: any, last_transaction_version: any, last_transaction_timestamp: any, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, uri: string, current_supply: any } | null }> }; | ||
export type GetTokenDataQuery = { __typename?: 'query_root', current_token_datas_v2: Array<{ __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null }> }; | ||
@@ -166,3 +167,3 @@ export type GetTokenOwnedFromCollectionQueryVariables = Types.Exact<{ | ||
export type GetTokenOwnedFromCollectionQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, is_fungible_v2?: boolean | null, is_soulbound_v2?: boolean | null, property_version_v1: any, table_type_v1?: string | null, token_properties_mutated_v1?: any | null, amount: any, last_transaction_timestamp: any, last_transaction_version: any, storage_id: string, owner_address: string, current_token_data?: { __typename?: 'current_token_datas_v2', token_name: string, token_data_id: string, token_uri: string, token_properties: any, supply: any, maximum?: any | null, last_transaction_version: any, last_transaction_timestamp: any, largest_property_version_v1?: any | null, current_collection?: { __typename?: 'current_collections_v2', collection_name: string, creator_address: string, description: string, uri: string, collection_id: string, last_transaction_version: any, current_supply: any, mutable_description?: boolean | null, total_minted_v2?: any | null, table_handle_v1?: string | null, mutable_uri?: boolean | null } | null } | null }> }; | ||
export type GetTokenOwnedFromCollectionQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }> }; | ||
@@ -177,3 +178,3 @@ export type GetTokenOwnersDataQueryVariables = Types.Exact<{ | ||
export type GetTokenOwnersDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', owner_address: string }> }; | ||
export type GetTokenOwnersDataQuery = { __typename?: 'query_root', current_token_ownerships_v2: Array<{ __typename?: 'current_token_ownerships_v2', token_standard: string, token_properties_mutated_v1?: any | null, token_data_id: string, table_type_v1?: string | null, storage_id: string, property_version_v1: any, owner_address: string, last_transaction_version: any, last_transaction_timestamp: any, is_soulbound_v2?: boolean | null, is_fungible_v2?: boolean | null, amount: any, current_token_data?: { __typename?: 'current_token_datas_v2', collection_id: string, description: string, is_fungible_v2?: boolean | null, largest_property_version_v1?: any | null, last_transaction_timestamp: any, last_transaction_version: any, maximum?: any | null, supply: any, token_data_id: string, token_name: string, token_properties: any, token_standard: string, token_uri: string, current_collection?: { __typename?: 'current_collections_v2', collection_id: string, collection_name: string, creator_address: string, current_supply: any, description: string, last_transaction_timestamp: any, last_transaction_version: any, max_supply?: any | null, mutable_description?: boolean | null, mutable_uri?: boolean | null, table_handle_v1?: string | null, token_standard: string, total_minted_v2?: any | null, uri: string } | null } | null }> }; | ||
@@ -188,5 +189,6 @@ export type GetTopUserTransactionsQueryVariables = Types.Exact<{ | ||
export type GetUserTransactionsQueryVariables = Types.Exact<{ | ||
where_condition: Types.User_Transactions_Bool_Exp; | ||
offset?: Types.InputMaybe<Types.Scalars['Int']>; | ||
limit?: Types.InputMaybe<Types.Scalars['Int']>; | ||
start_version?: Types.InputMaybe<Types.Scalars['bigint']>; | ||
offset?: Types.InputMaybe<Types.Scalars['Int']>; | ||
order_by?: Types.InputMaybe<Array<Types.User_Transactions_Order_By> | Types.User_Transactions_Order_By>; | ||
}>; | ||
@@ -196,1 +198,3 @@ | ||
export type GetUserTransactionsQuery = { __typename?: 'query_root', user_transactions: Array<{ __typename?: 'user_transactions', version: any }> }; | ||
export type TokenActivitiesFieldsFragment = { __typename?: 'token_activities_v2', after_value?: string | null, before_value?: string | null, entry_function_id_str?: string | null, event_account_address: string, event_index: any, from_address?: string | null, is_fungible_v2?: boolean | null, property_version_v1: any, to_address?: string | null, token_amount: any, token_data_id: string, token_standard: string, transaction_timestamp: any, transaction_version: any, type: string }; |
@@ -8,34 +8,42 @@ import * as Types from './operations'; | ||
token_standard | ||
is_fungible_v2 | ||
is_soulbound_v2 | ||
property_version_v1 | ||
token_properties_mutated_v1 | ||
token_data_id | ||
table_type_v1 | ||
token_properties_mutated_v1 | ||
amount | ||
last_transaction_timestamp | ||
last_transaction_version | ||
storage_id | ||
property_version_v1 | ||
owner_address | ||
last_transaction_version | ||
last_transaction_timestamp | ||
is_soulbound_v2 | ||
is_fungible_v2 | ||
amount | ||
current_token_data { | ||
collection_id | ||
description | ||
is_fungible_v2 | ||
largest_property_version_v1 | ||
last_transaction_timestamp | ||
last_transaction_version | ||
maximum | ||
supply | ||
token_data_id | ||
token_name | ||
token_data_id | ||
token_properties | ||
token_standard | ||
token_uri | ||
token_properties | ||
supply | ||
maximum | ||
last_transaction_version | ||
last_transaction_timestamp | ||
largest_property_version_v1 | ||
current_collection { | ||
collection_id | ||
collection_name | ||
creator_address | ||
current_supply | ||
description | ||
uri | ||
collection_id | ||
last_transaction_timestamp | ||
last_transaction_version | ||
current_supply | ||
max_supply | ||
mutable_description | ||
mutable_uri | ||
table_handle_v1 | ||
token_standard | ||
total_minted_v2 | ||
table_handle_v1 | ||
mutable_uri | ||
uri | ||
} | ||
@@ -67,2 +75,21 @@ } | ||
`; | ||
export const TokenActivitiesFieldsFragmentDoc = ` | ||
fragment TokenActivitiesFields on token_activities_v2 { | ||
after_value | ||
before_value | ||
entry_function_id_str | ||
event_account_address | ||
event_index | ||
from_address | ||
is_fungible_v2 | ||
property_version_v1 | ||
to_address | ||
token_amount | ||
token_data_id | ||
token_standard | ||
transaction_timestamp | ||
transaction_version | ||
type | ||
} | ||
`; | ||
export const GetAccountCoinsData = ` | ||
@@ -77,6 +104,17 @@ query getAccountCoinsData($owner_address: String, $offset: Int, $limit: Int) { | ||
coin_type | ||
coin_type_hash | ||
last_transaction_timestamp | ||
last_transaction_version | ||
owner_address | ||
coin_info { | ||
coin_type | ||
coin_type_hash | ||
creator_address | ||
decimals | ||
name | ||
decimals | ||
supply_aggregator_table_handle | ||
supply_aggregator_table_key | ||
symbol | ||
transaction_created_timestamp | ||
transaction_version_created | ||
} | ||
@@ -122,6 +160,3 @@ } | ||
query getAccountTransactionsCount($address: String) { | ||
move_resources_aggregate( | ||
where: {address: {_eq: $address}} | ||
distinct_on: transaction_version | ||
) { | ||
account_transactions_aggregate(where: {account_address: {_eq: $address}}) { | ||
aggregate { | ||
@@ -134,14 +169,17 @@ count | ||
export const GetAccountTransactionsData = ` | ||
query getAccountTransactionsData($address: String, $limit: Int, $offset: Int) { | ||
move_resources( | ||
where: {address: {_eq: $address}} | ||
order_by: {transaction_version: desc} | ||
distinct_on: transaction_version | ||
query getAccountTransactionsData($where_condition: account_transactions_bool_exp!, $offset: Int, $limit: Int, $order_by: [account_transactions_order_by!]) { | ||
account_transactions( | ||
where: $where_condition | ||
order_by: $order_by | ||
limit: $limit | ||
offset: $offset | ||
) { | ||
token_activities_v2 { | ||
...TokenActivitiesFields | ||
} | ||
transaction_version | ||
account_address | ||
} | ||
} | ||
`; | ||
${TokenActivitiesFieldsFragmentDoc}`; | ||
export const GetCollectionData = ` | ||
@@ -156,3 +194,2 @@ query getCollectionData($where_condition: current_collections_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collections_v2_order_by!]) { | ||
collection_id | ||
token_standard | ||
collection_name | ||
@@ -162,2 +199,10 @@ creator_address | ||
description | ||
last_transaction_timestamp | ||
last_transaction_version | ||
max_supply | ||
mutable_description | ||
mutable_uri | ||
table_handle_v1 | ||
token_standard | ||
total_minted_v2 | ||
uri | ||
@@ -176,14 +221,25 @@ } | ||
current_collection { | ||
collection_id | ||
collection_name | ||
creator_address | ||
collection_name | ||
token_standard | ||
collection_id | ||
current_supply | ||
description | ||
last_transaction_timestamp | ||
last_transaction_version | ||
mutable_description | ||
max_supply | ||
mutable_uri | ||
table_handle_v1 | ||
token_standard | ||
total_minted_v2 | ||
uri | ||
total_minted_v2 | ||
max_supply | ||
} | ||
collection_id | ||
collection_name | ||
collection_uri | ||
creator_address | ||
distinct_tokens | ||
last_transaction_version | ||
owner_address | ||
single_token_uri | ||
} | ||
@@ -220,2 +276,3 @@ } | ||
num_active_delegator | ||
pool_address | ||
} | ||
@@ -256,20 +313,6 @@ } | ||
) { | ||
after_value | ||
before_value | ||
entry_function_id_str | ||
event_account_address | ||
event_index | ||
from_address | ||
is_fungible_v2 | ||
property_version_v1 | ||
to_address | ||
token_amount | ||
token_data_id | ||
token_standard | ||
transaction_timestamp | ||
transaction_version | ||
type | ||
...TokenActivitiesFields | ||
} | ||
} | ||
`; | ||
${TokenActivitiesFieldsFragmentDoc}`; | ||
export const GetTokenActivitiesCount = ` | ||
@@ -292,6 +335,6 @@ query getTokenActivitiesCount($token_id: String) { | ||
) { | ||
owner_address | ||
...CurrentTokenOwnershipFields | ||
} | ||
} | ||
`; | ||
${CurrentTokenOwnershipFieldsFragmentDoc}`; | ||
export const GetTokenData = ` | ||
@@ -305,13 +348,15 @@ query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) { | ||
) { | ||
collection_id | ||
description | ||
is_fungible_v2 | ||
largest_property_version_v1 | ||
last_transaction_timestamp | ||
last_transaction_version | ||
maximum | ||
supply | ||
token_data_id | ||
token_name | ||
token_uri | ||
token_properties | ||
token_standard | ||
largest_property_version_v1 | ||
maximum | ||
is_fungible_v2 | ||
supply | ||
last_transaction_version | ||
last_transaction_timestamp | ||
token_uri | ||
current_collection { | ||
@@ -321,4 +366,13 @@ collection_id | ||
creator_address | ||
current_supply | ||
description | ||
last_transaction_timestamp | ||
last_transaction_version | ||
max_supply | ||
mutable_description | ||
mutable_uri | ||
table_handle_v1 | ||
token_standard | ||
total_minted_v2 | ||
uri | ||
current_supply | ||
} | ||
@@ -348,6 +402,6 @@ } | ||
) { | ||
owner_address | ||
...CurrentTokenOwnershipFields | ||
} | ||
} | ||
`; | ||
${CurrentTokenOwnershipFieldsFragmentDoc}`; | ||
export const GetTopUserTransactions = ` | ||
@@ -361,7 +415,7 @@ query getTopUserTransactions($limit: Int) { | ||
export const GetUserTransactions = ` | ||
query getUserTransactions($limit: Int, $start_version: bigint, $offset: Int) { | ||
query getUserTransactions($where_condition: user_transactions_bool_exp!, $offset: Int, $limit: Int, $order_by: [user_transactions_order_by!]) { | ||
user_transactions( | ||
order_by: $order_by | ||
where: $where_condition | ||
limit: $limit | ||
order_by: {version: desc} | ||
where: {version: {_lte: $start_version}} | ||
offset: $offset | ||
@@ -393,3 +447,3 @@ ) { | ||
}, | ||
getAccountTransactionsData(variables?: Types.GetAccountTransactionsDataQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetAccountTransactionsDataQuery> { | ||
getAccountTransactionsData(variables: Types.GetAccountTransactionsDataQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetAccountTransactionsDataQuery> { | ||
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetAccountTransactionsDataQuery>(GetAccountTransactionsData, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getAccountTransactionsData', 'query'); | ||
@@ -439,3 +493,3 @@ }, | ||
}, | ||
getUserTransactions(variables?: Types.GetUserTransactionsQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetUserTransactionsQuery> { | ||
getUserTransactions(variables: Types.GetUserTransactionsQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetUserTransactionsQuery> { | ||
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetUserTransactionsQuery>(GetUserTransactions, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getUserTransactions', 'query'); | ||
@@ -442,0 +496,0 @@ } |
@@ -11,2 +11,4 @@ // Copyright © Aptos Foundation | ||
export const TRANSFER_COINS = "0x1::aptos_account::transfer_coins"; | ||
export const COIN_TRANSFER = "0x1::coin::transfer"; | ||
/** | ||
@@ -90,4 +92,9 @@ * Class for working with the coin module, such as transferring coins and | ||
// If we should create the receiver account if it doesn't exist on-chain, | ||
// use the `0x1::aptos_account::transfer` function. | ||
const func = extraArgs?.createReceiverIfMissing ? "0x1::aptos_account::transfer_coins" : "0x1::coin::transfer"; | ||
// use the `0x1::aptos_account::transfer_coins` function. | ||
let func: string; | ||
if (extraArgs?.createReceiverIfMissing === undefined) { | ||
func = TRANSFER_COINS; | ||
} else { | ||
func = extraArgs?.createReceiverIfMissing ? TRANSFER_COINS : COIN_TRANSFER; | ||
} | ||
@@ -94,0 +101,0 @@ // Get the receiver address from the AptosAccount or MaybeHexString. |
@@ -50,2 +50,3 @@ import { AnyNumber } from "../bcs/types"; | ||
import { | ||
Account_Transactions_Order_By, | ||
Current_Collections_V2_Order_By, | ||
@@ -57,2 +58,3 @@ Current_Collection_Ownership_V2_View_Order_By, | ||
Token_Activities_V2_Order_By, | ||
User_Transactions_Order_By, | ||
} from "../indexer/generated/types"; | ||
@@ -369,2 +371,3 @@ | ||
token_data_id: { _eq: tokenAddress }, | ||
amount: { _gt: "0" }, | ||
}; | ||
@@ -484,3 +487,3 @@ | ||
* @param token token address (v2) or token data id (v1) | ||
* @returns GetOwnedTokensByTokenDataIdQuery response type | ||
* @returns GetOwnedTokensByTokenDataQuery response type | ||
*/ | ||
@@ -711,9 +714,22 @@ async getOwnedTokensByTokenData( | ||
accountAddress: MaybeHexString, | ||
options?: IndexerPaginationArgs, | ||
extraArgs?: { | ||
options?: IndexerPaginationArgs; | ||
orderBy?: IndexerSortBy<Account_Transactions_Order_By>[]; | ||
}, | ||
): Promise<GetAccountTransactionsDataQuery> { | ||
const address = HexString.ensure(accountAddress).hex(); | ||
IndexerClient.validateAddress(address); | ||
const whereCondition: any = { | ||
account_address: { _eq: address }, | ||
}; | ||
const graphqlQuery = { | ||
query: GetAccountTransactionsData, | ||
variables: { address, offset: options?.offset, limit: options?.limit }, | ||
variables: { | ||
where_condition: whereCondition, | ||
offset: extraArgs?.options?.offset, | ||
limit: extraArgs?.options?.limit, | ||
order_by: extraArgs?.orderBy, | ||
}, | ||
}; | ||
@@ -740,8 +756,22 @@ return this.queryIndexer(graphqlQuery); | ||
* | ||
* @param startVersion optional - can be set to tell indexer what version to start from | ||
* @returns GetUserTransactionsQuery response type | ||
*/ | ||
async getUserTransactions(startVersion?: number, options?: IndexerPaginationArgs): Promise<GetUserTransactionsQuery> { | ||
async getUserTransactions(extraArgs?: { | ||
startVersion?: number; | ||
options?: IndexerPaginationArgs; | ||
orderBy?: IndexerSortBy<User_Transactions_Order_By>[]; | ||
}): Promise<GetUserTransactionsQuery> { | ||
const whereCondition: any = { | ||
version: { _lte: extraArgs?.startVersion }, | ||
}; | ||
const graphqlQuery = { | ||
query: GetUserTransactions, | ||
variables: { start_version: startVersion, offset: options?.offset, limit: options?.limit }, | ||
variables: { | ||
where_condition: whereCondition, | ||
offset: extraArgs?.options?.offset, | ||
limit: extraArgs?.options?.limit, | ||
order_by: extraArgs?.orderBy, | ||
}, | ||
}; | ||
@@ -748,0 +778,0 @@ return this.queryIndexer(graphqlQuery); |
@@ -6,21 +6,2 @@ import { AptosApiError, aptosRequest } from "../../client"; | ||
test( | ||
"server response should include cookies", | ||
async () => { | ||
try { | ||
const response = await aptosRequest({ | ||
// use devnet as localnet doesnt set cookies | ||
url: "https://fullnode.devnet.aptoslabs.com/v1", | ||
method: "GET", | ||
originMethod: "test cookies", | ||
}); | ||
expect(response.headers).toHaveProperty("set-cookie"); | ||
} catch (error: any) { | ||
// should not get here | ||
expect(true).toBe(false); | ||
} | ||
}, | ||
longTestTimeout, | ||
); | ||
test( | ||
"call should include x-aptos-client header", | ||
@@ -27,0 +8,0 @@ async () => { |
@@ -7,3 +7,4 @@ // Copyright © Aptos Foundation | ||
import { AptosAccount } from "../../account/aptos_account"; | ||
import { CoinClient } from "../../plugins/coin_client"; | ||
import { COIN_TRANSFER, CoinClient, TRANSFER_COINS } from "../../plugins/coin_client"; | ||
import { EntryFunctionPayload, Transaction_UserTransaction } from "../../generated"; | ||
@@ -22,9 +23,13 @@ test( | ||
await client.waitForTransaction(await coinClient.transfer(alice, bob, 42), { checkSuccess: true }); | ||
const txnHash1 = await coinClient.transfer(alice, bob, 42); | ||
await client.waitForTransaction(txnHash1, { checkSuccess: true }); | ||
expect(await coinClient.checkBalance(bob)).toBe(BigInt(42)); | ||
let txn1 = (await client.getTransactionByHash(txnHash1)) as Transaction_UserTransaction; | ||
expect((txn1.payload as EntryFunctionPayload).function).toBe(TRANSFER_COINS); | ||
// Test that `createReceiverIfMissing` works. | ||
const jemima = new AptosAccount(); | ||
await client.waitForTransaction(await coinClient.transfer(alice, jemima, 717, { createReceiverIfMissing: true }), { | ||
const txnHash2 = await coinClient.transfer(alice, jemima, 717, { createReceiverIfMissing: true }); | ||
await client.waitForTransaction(txnHash2, { | ||
checkSuccess: true, | ||
@@ -35,4 +40,16 @@ }); | ||
expect(await coinClient.checkBalance(jemima.address().hex())).toBe(BigInt(717)); | ||
let txn2 = (await client.getTransactionByHash(txnHash2)) as Transaction_UserTransaction; | ||
expect((txn2.payload as EntryFunctionPayload).function).toBe(TRANSFER_COINS); | ||
// Test that `createReceiverIfMissing` works off (has to already be registered | ||
const txnHash3 = await coinClient.transfer(alice, jemima, 1234, { createReceiverIfMissing: false }); | ||
await client.waitForTransaction(txnHash3, { | ||
checkSuccess: true, | ||
}); | ||
expect(await coinClient.checkBalance(jemima.address().hex())).toBe(BigInt(1951)); | ||
let txn3 = (await client.getTransactionByHash(txnHash3)) as Transaction_UserTransaction; | ||
expect((txn3.payload as EntryFunctionPayload).function).toBe(COIN_TRANSFER); | ||
}, | ||
longTestTimeout, | ||
); |
@@ -51,11 +51,11 @@ import { AptosAccount } from "../../account/aptos_account"; | ||
console.log( | ||
`\n fullnode chain id is: ${fullNodeChainId}, indexer chain id is: ${indexerLedgerInfo.ledger_infos[0].chain_id}`, | ||
`\n devnet chain id is: ${fullNodeChainId}, indexer chain id is: ${indexerLedgerInfo.ledger_infos[0].chain_id}`, | ||
); | ||
if (indexerLedgerInfo.ledger_infos[0].chain_id !== fullNodeChainId) { | ||
console.log(`\n fullnode chain id and indexer chain id are not synced, skipping rest of tests`); | ||
console.log(`\n devnet chain id and indexer chain id are not synced, skipping rest of tests`); | ||
skipTest = true; | ||
runTests = describe.skip; | ||
} else { | ||
console.log(`\n fullnode chain id and indexer chain id are in synced, running tests`); | ||
console.log(`\n devnet chain id and indexer chain id are in synced, running tests`); | ||
} | ||
@@ -198,3 +198,2 @@ | ||
); | ||
expect(tokenData.current_token_datas_v2[0].token_standard).toEqual("v1"); | ||
expect(tokenData.current_token_datas_v2[0].token_name).toEqual(tokenName); | ||
@@ -318,3 +317,3 @@ }, | ||
const accountTransactionsCount = await indexerClient.getAccountTransactionsCount(alice.address().hex()); | ||
expect(accountTransactionsCount.move_resources_aggregate.aggregate?.count).toEqual(5); | ||
expect(accountTransactionsCount.account_transactions_aggregate.aggregate?.count).toEqual(5); | ||
}, | ||
@@ -328,3 +327,4 @@ longTestTimeout, | ||
const accountTransactionsData = await indexerClient.getAccountTransactionsData(alice.address().hex()); | ||
expect(accountTransactionsData.move_resources[0]).toHaveProperty("transaction_version"); | ||
expect(accountTransactionsData.account_transactions.length).toEqual(5); | ||
expect(accountTransactionsData.account_transactions[0]).toHaveProperty("transaction_version"); | ||
}, | ||
@@ -346,3 +346,3 @@ longTestTimeout, | ||
async () => { | ||
const userTransactions = await indexerClient.getUserTransactions(482294669, { limit: 4 }); | ||
const userTransactions = await indexerClient.getUserTransactions({ options: { limit: 4 } }); | ||
expect(userTransactions.user_transactions.length).toEqual(4); | ||
@@ -439,3 +439,15 @@ }, | ||
}); | ||
it( | ||
"gets account transactions data", | ||
async () => { | ||
const accountTransactionsData = await indexerClient.getAccountTransactionsData(alice.address().hex(), { | ||
orderBy: [{ transaction_version: "desc" }], | ||
}); | ||
expect(accountTransactionsData.account_transactions.length).toEqual(5); | ||
expect(accountTransactionsData.account_transactions[0]).toHaveProperty("transaction_version"); | ||
}, | ||
longTestTimeout, | ||
); | ||
}); | ||
}); |
// hardcoded for now, we would want to have it injected dynamically | ||
export const VERSION = "1.17.0"; | ||
export const VERSION = "1.18.0"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
50270
5381872