Skip to content

Commit

Permalink
fix: Various minor pre-launch bugs (#126)
Browse files Browse the repository at this point in the history
* fix: remove unnecessary logging

* feat: Adjust for decoded messages in transactions. retrieve tx hash

* fix: lint & tests

* fix: playwright tests

* chore: adjust test timeout

* feat: Add ToS and Privacy Policy

* feat: Localise terms/pp - add footer

* chore: linting

* fix: linear interpolation for special chars

* feat: terms adjustments

* fix: playwright tests fix attempt

* revert: remove unknown safari options
  • Loading branch information
clockworkgr authored Sep 13, 2024
1 parent a3fc9cb commit 4205611
Show file tree
Hide file tree
Showing 21 changed files with 1,991 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
- name: Build
run: pnpm build
- name: Run Playwright tests
run:
run: |
source .env.dev
serve -s dist -l 8080 &
pnpm exec playwright test
env:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Notwithstanding any other provision of this License, for material you add to a c
* **f)** Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors; or
* **g)** Requiring strong attribution such as notices on any user interfaces that run or convey any covered work, such as a prominent link to a URL on the header of a website, such that all users of the covered work may become aware of the notice, for a period no longer than 20 years.
*
Strong Attribution: If any of your user interfaces, such as websites and mobile applications, serve as the primary point of entry to a platform or blockchain that **(1)** offers users the ability to upload their own smart contracts to the platform or blockchain, and **(2)** leverages any Covered Work (including the GNO virtual machine) to run those smart contracts on the platform or blockchain (“Applicable Work”), then the Applicable Work must prominently link to **(1)** gno.land or **(2)** any other URL designated by NewTendermint, LLC that has not been rejected by the governance of the first chain known as gno.land, provided that the identity of the first chain is not ambiguous. In the event the identity of the first chain is ambiguous, then NewTendermint, LLC’s designation shall control. Such link must appear conspicuously in the header or footer of the Applicable Work, such that all users may learn of gno.land or the URL designated by NewTendermint, LLC. This additional attribution requirement shall remain in effect for **(1)** 7 years from the date of publication of the Applicable Work, or **(2)** 7 years from the date of publication of the Covered Work (including republication of new versions), whichever is later, but no later than 12 years after the application of this strong attribution requirement to the publication of the Applicable Work. For purposes of this Strong Attribution requirement, Covered Work shall mean any work that is licensed under the GNO Network General Public License, Version 3.0 or later, by NewTendermint, LLC.
Strong Attribution: If any of your user interfaces, such as websites and mobile applications, serve as the primary point of entry to a platform or blockchain that **(1)** offers users the ability to upload their own smart contracts to the platform or blockchain, and **(2)** leverages any Covered Work (including the GNO virtual machine) to run those smart contracts on the platform or blockchain (“Applicable Work”), then the Applicable Work must prominently link to **(1)** gno.land or **(2)** any other URL designated by NewTendermint, LLC that has not been rejected by the governance of the first chain known as gno.land, provided that the identity of the first chain is not ambiguous. In the event the identity of the first chain is ambiguous, then NewTendermint, LLC's designation shall control. Such link must appear conspicuously in the header or footer of the Applicable Work, such that all users may learn of gno.land or the URL designated by NewTendermint, LLC. This additional attribution requirement shall remain in effect for **(1)** 7 years from the date of publication of the Applicable Work, or **(2)** 7 years from the date of publication of the Covered Work (including republication of new versions), whichever is later, but no later than 12 years after the application of this strong attribution requirement to the publication of the Applicable Work. For purposes of this Strong Attribution requirement, Covered Work shall mean any work that is licensed under the GNO Network General Public License, Version 3.0 or later, by NewTendermint, LLC.

All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.

Expand Down
24 changes: 20 additions & 4 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,31 @@ export default defineConfig({
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
use: {
...devices["Desktop Chrome"],
bypassCSP: true, // add this to disable cors
launchOptions: {
args: ["--disable-web-security"], // add this to disable cors
},
},
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
use: {
...devices["Desktop Firefox"],
bypassCSP: true, // add this to disable cors
launchOptions: {
args: ["--disable-web-security"], // add this to disable cors
},
},
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
use: {
...devices["Desktop Safari"],
},
},

/* Test against mobile viewports. */
Expand All @@ -67,7 +81,9 @@ export default defineConfig({
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

expect: {
timeout: 10000,
},
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
Expand Down
1 change: 0 additions & 1 deletion src/components/common/MarkdownParser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ async function parseData() {
trimmedContent.value = Utility.purifyHtml(htmlContent);
} catch (_e) {
console.log("cool error bro");
console.log(_e);
bus.emit("error");
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/layout/FooterSection.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts" setup>
import { RouterLink } from "vue-router";
const links = [
{ title: "Twitter", url: "https://twitter.com/_govgen", icon: "twitter" },
{ title: "Discord", url: "https://discord.com/invite/atomone", icon: "discord" },
Expand All @@ -12,9 +14,11 @@ const links = [
<span>&copy; All in Bits 2024</span>
<div class="flex flex-col gap-4">
<!-- Text -->
<span>{{ $t("components.FooterSection.cta") }}</span>
<span class="flex justify-end">{{ $t("components.FooterSection.cta") }}</span>
<!-- Footer Social Links-->
<div class="flex flex-row gap-4 justify-end">
<RouterLink to="/terms" class="flex items-center hover:text-grey-50">Terms of Service</RouterLink> -
<RouterLink to="/privacy" class="flex items-center hover:text-grey-50">Privacy Policy</RouterLink> -
<a
v-for="(linkData, index) in links"
:key="index"
Expand Down
3 changes: 2 additions & 1 deletion src/components/proposals/Breakdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const offset = ref<number>(0);
const limit = ref<number>(10);
const votes = getAllVotes(props.proposalId, limit.value, offset.value);
console.log(votes);
const hasMore = computed(() => {
return (votes.value?.proposal_vote_aggregate.aggregate?.count ?? 0) > offset.value + limit.value;
});
Expand Down Expand Up @@ -44,7 +45,7 @@ const getTxHash = (vote: AllVotesQuery["proposal_vote"][0]) => {
tx.messages.filter((msg: { [x: string]: string | number }) => {
return (
msg["voter"] == vote.voter_address &&
msg["proposal_id"] == vote.proposal_id &&
msg["proposalId"] == vote.proposal_id &&
(msg["@type"] == "/govgen.gov.v1beta1.MsgVoteWeighted" || msg["@type"] == "/govgen.gov.v1beta1.MsgVote")
);
}).length > 0
Expand Down
2 changes: 1 addition & 1 deletion src/components/proposals/ValidatorBreakdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getTxHash = (vote: VotesQuery["proposal_vote"][0]) => {
tx.messages.filter((msg: { [x: string]: string | number }) => {
return (
msg["voter"] == vote.voter_address &&
msg["proposal_id"] == vote.proposal_id &&
msg["proposalId"] == vote.proposal_id &&
(msg["@type"] == "/govgen.gov.v1beta1.MsgVoteWeighted" || msg["@type"] == "/govgen.gov.v1beta1.MsgVote")
);
}).length > 0
Expand Down
8 changes: 4 additions & 4 deletions src/components/proposals/VotePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ const emits = defineEmits<{ (e: "onBreakdown"): void }>();
const pcts = computed(() => {
const sum = props.tokenTallies.yes + props.tokenTallies.no + props.tokenTallies.veto + props.tokenTallies.abstain;
return {
yes: props.tokenTallies.yes / sum,
no: props.tokenTallies.no / sum,
veto: props.tokenTallies.veto / sum,
abstain: props.tokenTallies.abstain / sum,
yes: sum > 0 ? props.tokenTallies.yes / sum : 0,
no: sum > 0 ? props.tokenTallies.no / sum : 0,
veto: sum > 0 ? props.tokenTallies.veto / sum : 0,
abstain: sum > 0 ? props.tokenTallies.abstain / sum : 0,
};
});
const totalVoteText = computed(() => {
Expand Down
3 changes: 0 additions & 3 deletions src/components/ui/UiTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ const tabIdx = ref<number>(0);
const props = withDefaults(defineProps<Props>(), { modelValue: undefined });
function changeTab(idx: number = 0, isClicked = true) {
tabIdx.value = idx;
console.log(props.options[tabIdx.value]);
console.log(isClicked);
if (isClicked) {
const link = props.options[tabIdx.value].link;
console.log(link);
if (link) {
window.open(link, "_blank");
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/composables/useChainData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const useChainData = () => {
}
};
const getProposal = (id: number) => {
const { result } = useProposalQuery({ id }, { pollInterval: 5000 });
const { result } = useProposalQuery({ id }, { pollInterval: 10000 });
return result;
};
const getParams = () => {
Expand All @@ -128,7 +128,7 @@ export const useChainData = () => {
return result;
};
const getProposalTallies = (id: number) => {
const { result } = useProposalTalliesQuery({ id }, { pollInterval: 5000 });
const { result } = useProposalTalliesQuery({ id }, { pollInterval: 10000 });
return result;
};
const getBlockHeight = (timestamp: string) => {
Expand Down Expand Up @@ -165,7 +165,7 @@ export const useChainData = () => {
return result;
};
const getAllVotes = (proposalId: number, limit: number, offset: number) => {
const { result } = useAllVotesQuery({ limit, offset, proposalId, propId: String(proposalId) });
const { result } = useAllVotesQuery({ limit, offset, proposalId });
return result;
};
const getVoteOption = (proposalId: number, option: string) => {
Expand Down Expand Up @@ -298,7 +298,7 @@ export const useChainData = () => {
};

const getAllVotesAsync = async (proposalId: number, limit: number, offset: number) => {
const result = useLazyAllVotesQuery({ limit, offset, proposalId, propId: String(proposalId) }).load();
const result = useLazyAllVotesQuery({ limit, offset, proposalId }).load();
return result;
};
const getVoteOptionAsync = async (proposalId: number, option: string) => {
Expand Down
1 change: 0 additions & 1 deletion src/composables/useProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const useProposals = () => {
cli: boolean = false,
) => {
if (cli) {
console.log("prop");
//TODO : CommandBuilder + proposal JSON Generation
} else {
const SubmitProposal: EncodeObject = {
Expand Down
6 changes: 3 additions & 3 deletions src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
*/
const documents = {
"query AllVotes($proposalId: Int!, $propId: String!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions: transactions(\n where: {messages: {_contains: [{proposal_id: $propId}]}}\n ) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}": types.AllVotesDocument,
"query AllVotes($proposalId: Int!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions(where: {messages: {_contains: [{proposalId: $proposalId}]}}) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}": types.AllVotesDocument,
"query Balance($address: String!) {\n action_account_balance: balances(\n where: {address: {_eq: $address}}\n order_by: {height: desc_nulls_last}\n limit: 1\n ) {\n coins\n }\n}": types.BalanceDocument,
"query BlockHeight($timestamp: timestamp!) {\n block(where: {timestamp: {_gte: $timestamp}}, order_by: {height: asc}, limit: 1) {\n timestamp\n height\n }\n}": types.BlockHeightDocument,
"query BlockTime($height: bigint) {\n block(where: {height: {_lte: $height}}, order_by: {height: desc}, limit: 1) {\n timestamp\n height\n }\n}": types.BlockTimeDocument,
Expand Down Expand Up @@ -51,7 +51,7 @@ export function graphql(source: string): unknown;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "query AllVotes($proposalId: Int!, $propId: String!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions: transactions(\n where: {messages: {_contains: [{proposal_id: $propId}]}}\n ) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}"): (typeof documents)["query AllVotes($proposalId: Int!, $propId: String!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions: transactions(\n where: {messages: {_contains: [{proposal_id: $propId}]}}\n ) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}"];
export function graphql(source: "query AllVotes($proposalId: Int!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions(where: {messages: {_contains: [{proposalId: $proposalId}]}}) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}"): (typeof documents)["query AllVotes($proposalId: Int!, $limit: Int!, $offset: Int!) {\n proposal_vote(\n limit: $limit\n offset: $offset\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n order_by: {height: desc, voter_address: desc}\n ) {\n height\n is_valid\n option\n proposal_id\n timestamp\n voter_address\n weight\n block {\n transactions(where: {messages: {_contains: [{proposalId: $proposalId}]}}) {\n height\n hash\n memo\n success\n messages\n }\n }\n }\n proposal_vote_aggregate(\n where: {_and: {proposal_id: {_eq: $proposalId}, is_valid: {_eq: true}}}\n ) {\n aggregate {\n count\n }\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down Expand Up @@ -129,4 +129,4 @@ export function graphql(source: string) {
return (documents as any)[source] ?? {};
}

export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
Loading

0 comments on commit 4205611

Please sign in to comment.