Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmaayan committed May 17, 2023
1 parent abbea23 commit 118e39a
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 70 deletions.
18 changes: 9 additions & 9 deletions ecosystem/typescript/sdk/src/indexer/generated/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ export type TokenDataFieldsFragment = { __typename?: 'current_token_datas', crea

export type CollectionDataFieldsFragment = { __typename?: 'current_collection_datas', metadata_uri: string, supply: any, description: string, collection_name: string, collection_data_id_hash: string, table_handle: string, creator_address: string };

export type GetAccountTokensQueryVariables = Types.Exact<{
address: Types.Scalars['String'];
offset?: Types.InputMaybe<Types.Scalars['Int']>;
limit?: Types.InputMaybe<Types.Scalars['Int']>;
}>;


export type GetAccountTokensQuery = { __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 GetAccountTokensCountQueryVariables = Types.Exact<{
owner_address?: Types.InputMaybe<Types.Scalars['String']>;
}>;
Expand Down Expand Up @@ -83,6 +74,15 @@ export type GetNumberOfDelegatorsQueryVariables = 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 GetOwnedTokensQueryVariables = Types.Exact<{
address: Types.Scalars['String'];
offset?: Types.InputMaybe<Types.Scalars['Int']>;
limit?: Types.InputMaybe<Types.Scalars['Int']>;
}>;


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 GetTokenActivitiesQueryVariables = Types.Exact<{
idHash: Types.Scalars['String'];
offset?: Types.InputMaybe<Types.Scalars['Int']>;
Expand Down
98 changes: 48 additions & 50 deletions ecosystem/typescript/sdk/src/indexer/generated/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,52 +62,6 @@ export const GetAccountCurrentTokens = `
}
${TokenDataFieldsFragmentDoc}
${CollectionDataFieldsFragmentDoc}`;
export const GetAccountTokens = `
query getAccountTokens($address: String!, $offset: Int, $limit: Int) {
current_token_ownerships_v2(
where: {owner_address: {_eq: $address}, amount: {_gt: 0}}
offset: $offset
limit: $limit
) {
token_standard
is_fungible_v2
is_soulbound_v2
is_soulbound_v2
property_version_v1
table_type_v1
token_properties_mutated_v1
amount
last_transaction_timestamp
last_transaction_version
storage_id
owner_address
current_token_data {
token_name
token_data_id
token_uri
token_properties
supply
maximum
last_transaction_version
last_transaction_timestamp
largest_property_version_v1
current_collection {
collection_name
creator_address
description
uri
collection_id
last_transaction_version
current_supply
mutable_description
total_minted_v2
table_handle_v1
mutable_uri
}
}
}
}
`;
export const GetAccountTokensCount = `
query getAccountTokensCount($owner_address: String) {
current_token_ownerships_aggregate(
Expand Down Expand Up @@ -188,6 +142,51 @@ export const GetNumberOfDelegators = `
}
}
`;
export const GetOwnedTokens = `
query getOwnedTokens($address: String!, $offset: Int, $limit: Int) {
current_token_ownerships_v2(
where: {owner_address: {_eq: $address}, amount: {_gt: 0}}
offset: $offset
limit: $limit
) {
token_standard
is_fungible_v2
is_soulbound_v2
property_version_v1
table_type_v1
token_properties_mutated_v1
amount
last_transaction_timestamp
last_transaction_version
storage_id
owner_address
current_token_data {
token_name
token_data_id
token_uri
token_properties
supply
maximum
last_transaction_version
last_transaction_timestamp
largest_property_version_v1
current_collection {
collection_name
creator_address
description
uri
collection_id
last_transaction_version
current_supply
mutable_description
total_minted_v2
table_handle_v1
mutable_uri
}
}
}
}
`;
export const GetTokenActivities = `
query getTokenActivities($idHash: String!, $offset: Int, $limit: Int) {
token_activities(
Expand Down Expand Up @@ -249,7 +248,6 @@ export const GetTokenOwnedFromCollection = `
token_standard
is_fungible_v2
is_soulbound_v2
is_soulbound_v2
property_version_v1
table_type_v1
token_properties_mutated_v1
Expand Down Expand Up @@ -327,9 +325,6 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
getAccountCurrentTokens(variables: Types.GetAccountCurrentTokensQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetAccountCurrentTokensQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetAccountCurrentTokensQuery>(GetAccountCurrentTokens, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getAccountCurrentTokens', 'query');
},
getAccountTokens(variables: Types.GetAccountTokensQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetAccountTokensQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetAccountTokensQuery>(GetAccountTokens, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getAccountTokens', 'query');
},
getAccountTokensCount(variables?: Types.GetAccountTokensCountQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetAccountTokensCountQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetAccountTokensCountQuery>(GetAccountTokensCount, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getAccountTokensCount', 'query');
},
Expand All @@ -351,6 +346,9 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
getNumberOfDelegators(variables?: Types.GetNumberOfDelegatorsQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetNumberOfDelegatorsQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetNumberOfDelegatorsQuery>(GetNumberOfDelegators, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getNumberOfDelegators', 'query');
},
getOwnedTokens(variables: Types.GetOwnedTokensQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetOwnedTokensQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetOwnedTokensQuery>(GetOwnedTokens, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getOwnedTokens', 'query');
},
getTokenActivities(variables: Types.GetTokenActivitiesQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise<Types.GetTokenActivitiesQuery> {
return withWrapper((wrappedRequestHeaders) => client.request<Types.GetTokenActivitiesQuery>(GetTokenActivities, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'getTokenActivities', 'query');
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
query getAccountTokens($address: String!, $offset: Int, $limit: Int) {
query getOwnedTokens($address: String!, $offset: Int, $limit: Int) {
current_token_ownerships_v2(
where: { owner_address: { _eq: $address }, amount: { _gt: 0 } }
offset: $offset
Expand All @@ -7,7 +7,6 @@ query getAccountTokens($address: String!, $offset: Int, $limit: Int) {
token_standard
is_fungible_v2
is_soulbound_v2
is_soulbound_v2
property_version_v1
table_type_v1
token_properties_mutated_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ query getTokenOwnedFromCollection($collection_id: String!, $owner_address: Strin
token_standard
is_fungible_v2
is_soulbound_v2
is_soulbound_v2
property_version_v1
table_type_v1
token_properties_mutated_v1
Expand Down
14 changes: 7 additions & 7 deletions ecosystem/typescript/sdk/src/providers/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
GetTokenOwnersDataQuery,
GetTopUserTransactionsQuery,
GetUserTransactionsQuery,
GetAccountTokensQuery,
GetOwnedTokensQuery,
GetTokenOwnedFromCollectionQuery,
GetCollectionDataQuery,
} from "../indexer/generated/operations";
Expand All @@ -36,7 +36,7 @@ import {
GetTokenOwnersData,
GetTopUserTransactions,
GetUserTransactions,
GetAccountTokens,
GetOwnedTokens,
GetTokenOwnedFromCollection,
GetCollectionData,
} from "../indexer/generated/queries";
Expand Down Expand Up @@ -320,22 +320,22 @@ export class IndexerClient {
}

/**
* Queries account's current tokens.
* Queries account's current owned tokens.
* This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.
*
* @param ownerAddress The token owner address we want to get the tokens for
* @returns GetAccountTokensQuery response type
* @returns GetOwnedTokensQuery response type
*/
async getAccountTokens(
async getOwnedTokens(
ownerAddress: MaybeHexString,
extraArgs?: {
options?: PaginationArgs;
},
): Promise<GetAccountTokensQuery> {
): Promise<GetOwnedTokensQuery> {
const address = HexString.ensure(ownerAddress).hex();
IndexerClient.validateAddress(address);
const graphqlQuery = {
query: GetAccountTokens,
query: GetOwnedTokens,
variables: { address, offset: extraArgs?.options?.offset, limit: extraArgs?.options?.limit },
};
return this.queryIndexer(graphqlQuery);
Expand Down
2 changes: 1 addition & 1 deletion ecosystem/typescript/sdk/src/tests/e2e/indexer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe("Indexer", () => {
});

it("gets account current tokens", async () => {
const tokens = await indexerClient.getAccountTokens(alice.address().hex());
const tokens = await indexerClient.getOwnedTokens(alice.address().hex());
expect(tokens.current_token_ownerships_v2).toHaveLength(2);
});

Expand Down

0 comments on commit 118e39a

Please sign in to comment.