Skip to content

Commit

Permalink
Update naming for query params (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
desfero authored Sep 15, 2023
1 parent 2922722 commit 3928c8d
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 47 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/LensClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe(`Given storage and two ${LensClient.name} instances sharing the same st
const wallet = Wallet.createRandom();
const walletAddress = await wallet.getAddress();
const { id, text } = await client1.authentication.generateChallenge({
address: walletAddress,
profileId: '1',
for: '1',
signedBy: walletAddress,
});
const signature = await wallet.signMessage(text);

Expand Down
46 changes: 23 additions & 23 deletions packages/client/src/graphql/types.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export type ActOnOpenActionRequest = {
};

export type AlreadyInvitedCheckRequest = {
address: Scalars['EvmAddress']['input'];
for: Scalars['EvmAddress']['input'];
};

export type AmountInput = {
Expand Down Expand Up @@ -144,9 +144,9 @@ export type BroadcastRequest = {

export type ChallengeRequest = {
/** The profile ID to initiate a challenge */
address: Scalars['EvmAddress']['input'];
/** The profile ID to initiate a challenge */
profileId: Scalars['ProfileId']['input'];
for: Scalars['ProfileId']['input'];
/** The Ethereum address that will sign the challenge */
signedBy: Scalars['EvmAddress']['input'];
};

export type ChangeProfileManager = {
Expand Down Expand Up @@ -444,7 +444,7 @@ export type GdmRequest = {
};

export type GenerateModuleCurrencyApprovalDataRequest = {
allowance: Scalars['EvmAddress']['input'];
allowance: AmountInput;
module: ModuleCurrencyApproval;
};

Expand Down Expand Up @@ -548,9 +548,9 @@ export enum LensTransactionFailureType {

export type LensTransactionStatusRequest = {
/** Transaction hash for retrieving transaction status */
txHash?: InputMaybe<Scalars['TxHash']['input']>;
forTxHash?: InputMaybe<Scalars['TxHash']['input']>;
/** Transaction ID for retrieving transaction status when using the broadcaster */
txId?: InputMaybe<Scalars['TxId']['input']>;
forTxId?: InputMaybe<Scalars['TxId']['input']>;
};

export enum LensTransactionStatusType {
Expand Down Expand Up @@ -601,7 +601,7 @@ export type MomokaQuoteRequest = {

export type MomokaTransactionRequest = {
/** The momoka transaction id or internal publication id */
id: Scalars['String']['input'];
for: Scalars['String']['input'];
};

export type MomokaTransactionsRequest = {
Expand Down Expand Up @@ -661,10 +661,10 @@ export type MutualFollowersRequest = {
export type MutualNftCollectionsRequest = {
cursor?: InputMaybe<Scalars['Cursor']['input']>;
limit?: InputMaybe<LimitType>;
/** Profile id of the second user */
viewingProfileId: Scalars['ProfileId']['input'];
/** Profile id of the first user */
yourProfileId: Scalars['ProfileId']['input'];
observer: Scalars['ProfileId']['input'];
/** Profile id of the second user */
viewing: Scalars['ProfileId']['input'];
};

export type MutualPoapsQueryRequest = {
Expand All @@ -691,13 +691,13 @@ export enum NftCollectionOwnersOrder {

/** NFT collection owners request */
export type NftCollectionOwnersRequest = {
/** The contract address */
address: Scalars['EvmAddress']['input'];
/** The profile id to use when ordering by followers */
by?: InputMaybe<Scalars['ProfileId']['input']>;
/** The chain id */
chainId: Scalars['ChainId']['input'];
cursor?: InputMaybe<Scalars['Cursor']['input']>;
/** The profile id to use when ordering by followers */
for?: InputMaybe<Scalars['ProfileId']['input']>;
/** The contract address */
for: Scalars['EvmAddress']['input'];
limit?: InputMaybe<LimitType>;
/** The ordering of Nft collection owners */
order?: InputMaybe<NftCollectionOwnersOrder>;
Expand Down Expand Up @@ -896,9 +896,9 @@ export enum OpenActionModuleType {
}

export type OwnedHandlesRequest = {
/** The Ethereum address for which to retrieve owned handles */
address: Scalars['EvmAddress']['input'];
cursor?: InputMaybe<Scalars['Cursor']['input']>;
/** The Ethereum address for which to retrieve owned handles */
for: Scalars['EvmAddress']['input'];
limit?: InputMaybe<LimitType>;
};

Expand Down Expand Up @@ -1064,9 +1064,9 @@ export type ProfileRecommendationsRequest = {

export type ProfileRequest = {
/** The handle for profile you want to fetch */
handle?: InputMaybe<Scalars['Handle']['input']>;
forHandle?: InputMaybe<Scalars['Handle']['input']>;
/** The profile you want to fetch */
profileId?: InputMaybe<Scalars['ProfileId']['input']>;
forProfileId?: InputMaybe<Scalars['ProfileId']['input']>;
};

export type ProfileSearchRequest = {
Expand Down Expand Up @@ -1097,9 +1097,9 @@ export type ProfileStatsReactionArgs = {
};

export type ProfilesManagedRequest = {
/** The Ethereum address for which to retrieve managed profiles */
address: Scalars['EvmAddress']['input'];
cursor?: InputMaybe<Scalars['Cursor']['input']>;
/** The Ethereum address for which to retrieve managed profiles */
for: Scalars['EvmAddress']['input'];
limit?: InputMaybe<LimitType>;
};

Expand Down Expand Up @@ -1293,8 +1293,8 @@ export enum PublicationReportingSpamSubreason {
}

export type PublicationRequest = {
id?: InputMaybe<Scalars['PublicationId']['input']>;
txHash?: InputMaybe<Scalars['TxHash']['input']>;
forId?: InputMaybe<Scalars['PublicationId']['input']>;
forTxHash?: InputMaybe<Scalars['TxHash']['input']>;
};

export type PublicationRevenueRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
PaginatedResultInfoFragmentDoc,
} from '../../../graphql/fragments.generated';
export type InvitedResultFragment = {
invited: string;
by: string;
when: string;
profileMinted: ProfileFragment | null;
};
Expand All @@ -38,7 +38,7 @@ export type InviteProfileMutation = { inviteProfile: string | null };

export const InvitedResultFragmentDoc = gql`
fragment InvitedResult on InvitedResult {
invited
by
profileMinted {
...Profile
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fragment InvitedResult on InvitedResult {
invited
by
profileMinted {
...Profile
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Types from '../../../graphql/types.generated';

import {
NetworkAddressFragment,
AmountFragment,
Erc20Fragment,
PaginatedResultInfoFragment,
ImageFragment,
Expand All @@ -13,6 +14,7 @@ import { print } from 'graphql';
import gql from 'graphql-tag';
import {
NetworkAddressFragmentDoc,
AmountFragmentDoc,
Erc20FragmentDoc,
PaginatedResultInfoFragmentDoc,
ImageFragmentDoc,
Expand All @@ -34,8 +36,8 @@ export type UnknownSupportedModuleFragment = {

export type ApprovedAllowanceAmountResultFragment = {
moduleName: string;
allowance: string;
moduleContract: NetworkAddressFragment;
allowance: AmountFragment;
};

export type GenerateModuleCurrencyApprovalResultFragment = {
Expand All @@ -54,6 +56,7 @@ export type CurrenciesQuery = {

export type ApprovedModuleAllowanceAmountQueryVariables = Types.Exact<{
request: Types.ApprovedModuleAllowanceAmountRequest;
rateRequest?: Types.InputMaybe<Types.RateRequest>;
}>;

export type ApprovedModuleAllowanceAmountQuery = {
Expand Down Expand Up @@ -152,9 +155,12 @@ export const ApprovedAllowanceAmountResultFragmentDoc = gql`
moduleContract {
...NetworkAddress
}
allowance
allowance {
...Amount
}
}
${NetworkAddressFragmentDoc}
${AmountFragmentDoc}
`;
export const GenerateModuleCurrencyApprovalResultFragmentDoc = gql`
fragment GenerateModuleCurrencyApprovalResult on GenerateModuleCurrencyApprovalResult {
Expand All @@ -178,7 +184,10 @@ export const CurrenciesDocument = gql`
${PaginatedResultInfoFragmentDoc}
`;
export const ApprovedModuleAllowanceAmountDocument = gql`
query ApprovedModuleAllowanceAmount($request: ApprovedModuleAllowanceAmountRequest!) {
query ApprovedModuleAllowanceAmount(
$request: ApprovedModuleAllowanceAmountRequest!
$rateRequest: RateRequest = { for: USD }
) {
result: approvedModuleAllowanceAmount(request: $request) {
... on ApprovedAllowanceAmountResult {
...ApprovedAllowanceAmountResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ fragment ApprovedAllowanceAmountResult on ApprovedAllowanceAmountResult {
moduleContract {
...NetworkAddress
}
allowance
allowance {
...Amount
}
}

fragment GenerateModuleCurrencyApprovalResult on GenerateModuleCurrencyApprovalResult {
Expand All @@ -51,7 +53,10 @@ query Currencies($request: PaginatedOffsetRequest!) {
}
}

query ApprovedModuleAllowanceAmount($request: ApprovedModuleAllowanceAmountRequest!) {
query ApprovedModuleAllowanceAmount(
$request: ApprovedModuleAllowanceAmountRequest!
$rateRequest: RateRequest = { for: USD }
) {
result: approvedModuleAllowanceAmount(request: $request) {
... on ApprovedAllowanceAmountResult {
...ApprovedAllowanceAmountResult
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/submodules/nfts/Nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
} from '../../helpers';
import {
NftFragment,
NftGalleryFragment,
NftOwnershipChallengeResultFragment,
Sdk,
getSdk,
PaginatedNftGalleriesResultFragment,
} from './graphql/nfts.generated';

/**
Expand Down Expand Up @@ -108,7 +108,7 @@ export class Nfts {
* Fetch NFT galleries of a profile.
*
* @param request - Request object for the query
* @returns Array of {@link NftGalleryFragment}
* @returns Paginated array of {@link NftGalleryFragment}
*
* @example
* ```ts
Expand All @@ -117,7 +117,7 @@ export class Nfts {
* });
* ```
*/
async fetchGalleries(request: NftGalleriesRequest): Promise<NftGalleryFragment[]> {
async fetchGalleries(request: NftGalleriesRequest): Promise<PaginatedNftGalleriesResultFragment> {
const result = await this.sdk.ProfileGalleries({ request });

return result.data.result;
Expand Down
25 changes: 22 additions & 3 deletions packages/client/src/submodules/nfts/graphql/nfts.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Types from '../../../graphql/types.generated';

import {
NetworkAddressFragment,
AmountFragment,
Erc20Fragment,
PaginatedResultInfoFragment,
ImageFragment,
Expand All @@ -13,6 +14,7 @@ import { print } from 'graphql';
import gql from 'graphql-tag';
import {
NetworkAddressFragmentDoc,
AmountFragmentDoc,
Erc20FragmentDoc,
PaginatedResultInfoFragmentDoc,
ImageFragmentDoc,
Expand Down Expand Up @@ -51,6 +53,11 @@ export type NftGalleryFragment = {
items: Array<NftFragment>;
};

export type PaginatedNftGalleriesResultFragment = {
items: Array<NftGalleryFragment>;
pageInfo: PaginatedResultInfoFragment;
};

export type NftOwnershipChallengeResultFragment = { success: boolean; info: string | null };

export type NftsQueryVariables = Types.Exact<{
Expand All @@ -65,7 +72,7 @@ export type ProfileGalleriesQueryVariables = Types.Exact<{
request: Types.NftGalleriesRequest;
}>;

export type ProfileGalleriesQuery = { result: Array<NftGalleryFragment> };
export type ProfileGalleriesQuery = { result: PaginatedNftGalleriesResultFragment };

export type NftOwnershipChallengeMutationVariables = Types.Exact<{
request: Types.NftOwnershipChallengeRequest;
Expand Down Expand Up @@ -169,6 +176,18 @@ export const NftGalleryFragmentDoc = gql`
}
${NftFragmentDoc}
`;
export const PaginatedNftGalleriesResultFragmentDoc = gql`
fragment PaginatedNftGalleriesResult on PaginatedNftGalleriesResult {
items {
...NftGallery
}
pageInfo {
...PaginatedResultInfo
}
}
${NftGalleryFragmentDoc}
${PaginatedResultInfoFragmentDoc}
`;
export const NftOwnershipChallengeResultFragmentDoc = gql`
fragment NftOwnershipChallengeResult on NftOwnershipChallengeResult {
success
Expand All @@ -192,10 +211,10 @@ export const NftsDocument = gql`
export const ProfileGalleriesDocument = gql`
query ProfileGalleries($request: NftGalleriesRequest!) {
result: nftGalleries(request: $request) {
...NftGallery
...PaginatedNftGalleriesResult
}
}
${NftGalleryFragmentDoc}
${PaginatedNftGalleriesResultFragmentDoc}
`;
export const NftOwnershipChallengeDocument = gql`
mutation NftOwnershipChallenge($request: NftOwnershipChallengeRequest!) {
Expand Down
11 changes: 10 additions & 1 deletion packages/client/src/submodules/nfts/graphql/nfts.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ fragment NftGallery on NftGallery {
}
}

fragment PaginatedNftGalleriesResult on PaginatedNftGalleriesResult {
items {
...NftGallery
}
pageInfo {
...PaginatedResultInfo
}
}

fragment NftOwnershipChallengeResult on NftOwnershipChallengeResult {
success
info
Expand All @@ -71,7 +80,7 @@ query Nfts($request: NftsRequest!) {

query ProfileGalleries($request: NftGalleriesRequest!) {
result: nftGalleries(request: $request) {
...NftGallery
...PaginatedNftGalleriesResult
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/submodules/transaction/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class Transaction {
}

async txIdToTxHash(txId: string): Promise<string | null> {
const result = await this.sdk.TxIdToTxHash({ txId });
const result = await this.sdk.TxIdToTxHash({ for: txId });
return result.data.result;
}

Expand Down Expand Up @@ -94,7 +94,7 @@ export class Transaction {
CredentialsExpiredError | NotAuthenticatedError
> {
return poll({
fn: () => this.status({ txId }),
fn: () => this.status({ forTxId: txId }),
validate: (result: Awaited<ReturnType<typeof this.status>>) => {
if (result.isSuccess()) {
const value = result.value;
Expand Down
Loading

0 comments on commit 3928c8d

Please sign in to comment.