-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add bridging widget to checkout (#3645) --------- Co-authored-by: 0xKurt <[email protected]> * chore: redo donation history page (#3666) Co-authored-by: Aditya Anand M C <[email protected]> * feat: add mint attestation to thank you page (#3662) * added mint attestation workflow in donation history page and code ref… (#3671) * added mint attestation workflow in donation history page and code refactoring * workflow improvements * refactored attestation mint modal * chore: check transaction minting in history page (#3676) * feat: implemented data-layer attestationService * chore: implemented useMintingAttestations * chore: renamed useContributionHistory to useContributionsByDonor * refactor: useContributionsByDonor now uses useQuery * chore: useMintingAttestations export type and add default parameter * chore: changed MintDonationButtonProps * chore: check if transaction is minted - propDrilling * fix: data-layer attestation types * chore: moved ImageWithLoading to common feature * fix: DonationsTransactions - missing key in rendering map * chore: AttestationService - added metadata and timestamp to query * chore: useMintingAttestations sort response by timestamp desc * fix: MintingAttestationIdsData - metadata is array * chore: remove MintDonationButton from MintDonationImapactAction * chore: implemented modal and used it to display MintingImage * Update packages/builder/src/components/grants/rounds/LinkManager.tsx * bump : squid widget (#3677) * bump : squid widget * fix * remove unused coe * Gg22 thank you page improvs (#3679) * seperated checkoutStore with attestation store * getting round names for attestation frame for thank you page * allow minting below 20 attestation has no fee (#3678) * add zero fee attestation * free mint when totalAttestation < threshold * chore: view attestation modal design (#3681) * chore: added close icon * chore: added responsiveness to TransactionHeader * chore: implemented RainbowBorderButton * chore: implemented ViewTransactionButton * refactor: MindDonationButton renders RainbowBorderButton * chore: implemented ViewAttestationModal * chore: refactored Modal * chore: use ViewAttestationModal in MintingActionButtons * chore: added go to attestation transaction page functionality * improved attestation frame made it more dynamic-minimal (#3682) * improved attestation frame made it more dynamic-minimal * make sure the frame projects images are fetched * dynamic handling of fees and proxy attestations implementation (#3687) * adds twitter sharable urls * fix: update encoding and format for farcaster share URLs * chore: make bridge button more prominent close PAR-530 * - revese ui on thank you page mobile screen - add border to twitter button close PAR-531 close PAR-528 * fix title --------- Co-authored-by: 0xKurt <[email protected]> Co-authored-by: Huss Martinez <[email protected]> Co-authored-by: Nick Lionis <[email protected]> Co-authored-by: Nick Lionis <[email protected]> Co-authored-by: veganbeef <[email protected]>
- Loading branch information
1 parent
dddff65
commit 828a7d0
Showing
202 changed files
with
14,582 additions
and
7,951 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/data-layer/src/services/AttestationService/AttestationService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { gql, request } from "graphql-request"; | ||
import { MintingAttestationIdsData } from "./types"; | ||
|
||
export class AttestationService { | ||
private gsIndexerEndpoint: string; | ||
|
||
constructor(gsIndexerEndpoint: string) { | ||
this.gsIndexerEndpoint = gsIndexerEndpoint; | ||
} | ||
|
||
async getMintingAttestationIdsByTransactionHash({ | ||
transactionHashes, | ||
}: { | ||
transactionHashes: string[]; | ||
}): Promise<MintingAttestationIdsData[]> { | ||
const query = gql` | ||
query getMintingAttestationIdsByTransactionHash( | ||
$transactionHashes: [String!]! | ||
) { | ||
attestationTxns(filter: { txnHash: { in: $transactionHashes } }) { | ||
txnHash | ||
attestationUid | ||
attestationChainId | ||
attestation { | ||
metadata | ||
timestamp | ||
} | ||
} | ||
} | ||
`; | ||
|
||
const response: { attestationTxns: MintingAttestationIdsData[] } = | ||
await request(this.gsIndexerEndpoint, query, { | ||
transactionHashes, | ||
}); | ||
|
||
return response.attestationTxns; | ||
} | ||
|
||
async getAttestationCount({ | ||
attestationChainIds | ||
}: { | ||
attestationChainIds: number[]; | ||
}) : Promise<number> { | ||
const query = gql` | ||
query getAttestationCount( | ||
$attestationChainIds: [Int!]! | ||
) { | ||
attestations(filter: { | ||
chainId: { in: $attestationChainIds } | ||
}) { | ||
uid | ||
} | ||
} | ||
`; | ||
|
||
const response: { attestations: any[] } = | ||
await request(this.gsIndexerEndpoint, query, { | ||
attestationChainIds, | ||
}); | ||
|
||
return response.attestations.length; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { AttestationService } from "./AttestationService"; | ||
export * from "./types"; |
11 changes: 11 additions & 0 deletions
11
packages/data-layer/src/services/AttestationService/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export type MintingAttestationIdsData = { | ||
txnHash: string; | ||
attestationUid: string; | ||
attestationChainId: string; | ||
attestation: { | ||
metadata: { | ||
impactImageCid: string; | ||
}[]; | ||
timestamp: string; | ||
}; | ||
}; |
59 changes: 59 additions & 0 deletions
59
packages/data-layer/src/services/__tests__/AttestationService.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { describe, it, expect, vi } from "vitest"; | ||
import { request } from "graphql-request"; | ||
import { AttestationService } from "../AttestationService/AttestationService"; | ||
import { | ||
mockEmptyResponse, | ||
mockEmptyTransactionHashes, | ||
mockResponse, | ||
mockTransactionHashes, | ||
} from "./mocks"; | ||
|
||
// Mock the request function from graphql-request | ||
vi.mock("graphql-request", async () => { | ||
const actual = await vi.importActual("graphql-request"); | ||
return { | ||
...(actual ?? {}), | ||
request: vi.fn(), // Mock the request function | ||
}; | ||
}); | ||
|
||
describe("AttestationService", () => { | ||
const gsIndexerEndpoint = "http://mock-endpoint.com/graphql"; | ||
const service = new AttestationService(gsIndexerEndpoint); | ||
|
||
it("should fetch and return minting attestation IDs", async () => { | ||
// Mock the request function to return the mock response | ||
(request as ReturnType<typeof vi.fn>).mockResolvedValue(mockResponse); | ||
|
||
const result = await service.getMintingAttestationIdsByTransactionHash({ | ||
transactionHashes: mockTransactionHashes, | ||
}); | ||
|
||
expect(request).toHaveBeenCalledWith( | ||
gsIndexerEndpoint, | ||
expect.any(String), | ||
{ | ||
transactionHashes: mockTransactionHashes, | ||
}, | ||
); | ||
expect(result).toEqual(mockResponse.attestationTxns); | ||
}); | ||
|
||
it("should fetch and return an empty array if transactionHashes is an empty array", async () => { | ||
// Mock the request function to return the mock response | ||
(request as ReturnType<typeof vi.fn>).mockResolvedValue(mockEmptyResponse); | ||
|
||
const result = await service.getMintingAttestationIdsByTransactionHash({ | ||
transactionHashes: mockEmptyTransactionHashes, | ||
}); | ||
|
||
expect(request).toHaveBeenCalledWith( | ||
gsIndexerEndpoint, | ||
expect.any(String), | ||
{ | ||
transactionHashes: mockEmptyTransactionHashes, | ||
}, | ||
); | ||
expect(result).toEqual(mockEmptyResponse.attestationTxns); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const mockTransactionHashes = ["hash1", "hash2"]; | ||
export const mockResponse = { | ||
attestationTxns: [ | ||
{ | ||
txnHash: "hash1", | ||
attestationUid: "uid1", | ||
attestationChainId: "chain1", | ||
}, | ||
{ | ||
txnHash: "hash1", | ||
attestationUid: "uid2", | ||
attestationChainId: "chain1", | ||
}, | ||
{ | ||
txnHash: "hash2", | ||
attestationUid: "uid3", | ||
attestationChainId: "chain2", | ||
}, | ||
], | ||
}; | ||
|
||
export const mockEmptyTransactionHashes = []; | ||
export const mockEmptyResponse = { | ||
attestationTxns: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Oops, something went wrong.