From e87c934d8ad31d8fd7984c0f280758e5f96afcf8 Mon Sep 17 00:00:00 2001 From: "nicoacosta.eth" Date: Fri, 18 Oct 2024 19:39:12 -0300 Subject: [PATCH] queries: update examples --- examples/plasa-query.ts | 1 + ts-interfaces/examples/plasa-query.ts | 124 ++++++++++++----------- ts-interfaces/examples/question-query.ts | 118 --------------------- 3 files changed, 64 insertions(+), 179 deletions(-) create mode 100644 examples/plasa-query.ts delete mode 100644 ts-interfaces/examples/question-query.ts diff --git a/examples/plasa-query.ts b/examples/plasa-query.ts new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/examples/plasa-query.ts @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ts-interfaces/examples/plasa-query.ts b/ts-interfaces/examples/plasa-query.ts index daf16f1..29c545d 100644 --- a/ts-interfaces/examples/plasa-query.ts +++ b/ts-interfaces/examples/plasa-query.ts @@ -1,86 +1,88 @@ -import { PlasaView } from "../types/plasa" -import { StampType, StampView } from "../types/stamps" +import { PlasaView, PlasaData, PlasaUser } from "../types/plasa" +import { StampType, StampView, StampData, StampUser } from "../types/stamps" import { AccountAddress, Timestamp } from "../types/basic" -import { SpacePreview } from "../types/spaces" +import { SpacePreview, SpaceData, SpaceUser, RolesUser, PermissionsUser } from "../types/spaces" + const examplePlasaQuery: PlasaView = { data: { contractAddress: "0x1234567890123456789012345678901234567890" as AccountAddress, - chainId: 1 as number, - version: "1.0.0" as string - }, + chainId: 1, + version: "0.1.0" + } as PlasaData, + user: { - username: "alice" as string - }, + username: "alice" + } as PlasaUser, + stamps: [ { data: { - contractAddress: "0xabcdef1234567890abcdef1234567890abcdef12" as AccountAddress, - spaceAddress: "0x1111222233334444555566667777888899990000" as AccountAddress, - stampType: StampType.AccountOwnership as StampType, - name: "Twitter Account Ownership" as string, - symbol: "TWO" as string, - platform: "Twitter" as string, - totalSupply: 1000000 as number - }, + contractAddress: "0x2345678901234567890123456789012345678901" as AccountAddress, + stampType: StampType.AccountOwnership, + name: "Account Ownership Stamp", + symbol: "AOS", + totalSupply: 1000, + specific: "0x" // No specific data for this stamp type + } as StampData, user: { - owns: true as boolean, - stampId: 123456 as number, - mintingTimestamp: 1625097600000 as Timestamp - } + owns: true, + stampId: 42, + mintingTimestamp: 1625097600 as Timestamp, + specific: "0x" // No specific data for this stamp type + } as StampUser } as StampView, { data: { - contractAddress: "0x9876543210fedcba9876543210fedcba98765432" as AccountAddress, - spaceAddress: "0x1111222233334444555566667777888899990000" as AccountAddress, - stampType: StampType.FollowerSince as StampType, - name: "Early Follower" as string, - symbol: "EF" as string, - platform: "Twitter" as string, - totalSupply: 5000 as number, - specific: "0x1111222233334444555566667777888899990000" as AccountAddress // followedAccount - }, + contractAddress: "0x3456789012345678901234567890123456789012" as AccountAddress, + stampType: StampType.FollowerSince, + name: "Follower Since Stamp", + symbol: "FSS", + totalSupply: 5000, + specific: "0x0000000000000000000000000000000000000000000000000000000060e316a0" // Encoded timestamp + } as StampData, user: { - owns: true as boolean, - stampId: 789012 as number, - mintingTimestamp: 1625184000000 as Timestamp, - specific: 1625097600000 as Timestamp // follow date - } + owns: true, + stampId: 123, + mintingTimestamp: 1625184000 as Timestamp, + specific: "0x0000000000000000000000000000000000000000000000000000000060e316a0" // Encoded timestamp + } as StampUser } as StampView ], + spaces: [ { data: { - contractAddress: "0x1111222233334444555566667777888899990000" as AccountAddress, - name: "CryptoNews" as string, - description: "Latest news and updates in the crypto space" as string, - imageUrl: "https://example.com/crypto-news.png" as string, - creationTimestamp: 1625000000000 as Timestamp - }, + contractAddress: "0x4567890123456789012345678901234567890123" as AccountAddress, + name: "Governance Space", + description: "A space for community governance", + imageUrl: "https://example.com/governance-space.png", + creationTimestamp: 1625270400 as Timestamp + } as SpaceData, user: { roles: { - superAdmin: false as boolean, - admin: true as boolean, - mod: true as boolean - }, + superAdmin: false, + admin: true, + mod: true + } as RolesUser, permissions: { - UpdateSpaceInfo: true as boolean, - UpdateSpacePoints: true as boolean, - UpdateQuestionInfo: true as boolean, - UpdateQuestionDeadline: true as boolean, - UpdateQuestionPoints: true as boolean, - CreateFixedQuestion: true as boolean, - CreateOpenQuestion: true as boolean, - VetoFixedQuestion: true as boolean, - VetoOpenQuestion: true as boolean, - VetoOpenQuestionOption: true as boolean, - LiftVetoFixedQuestion: true as boolean, - LiftVetoOpenQuestion: true as boolean, - LiftVetoOpenQuestionOption: true as boolean, - AddOpenQuestionOption: true as boolean - } - } + UpdateSpaceInfo: true, + UpdateSpacePoints: true, + UpdateQuestionInfo: true, + UpdateQuestionDeadline: true, + UpdateQuestionPoints: true, + CreateFixedQuestion: true, + CreateOpenQuestion: true, + VetoFixedQuestion: false, + VetoOpenQuestion: false, + VetoOpenQuestionOption: false, + LiftVetoFixedQuestion: false, + LiftVetoOpenQuestion: false, + LiftVetoOpenQuestionOption: false, + AddOpenQuestionOption: true + } as PermissionsUser + } as SpaceUser } as SpacePreview ] -} +} as PlasaView console.log(JSON.stringify(examplePlasaQuery, null, 2)) diff --git a/ts-interfaces/examples/question-query.ts b/ts-interfaces/examples/question-query.ts deleted file mode 100644 index 1d478e4..0000000 --- a/ts-interfaces/examples/question-query.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { QuestionView, QuestionType } from "../types/questions" -import { AccountAddress, Timestamp } from "../types/basic" - -const exampleQuestionQuery: QuestionView = { - data: { - contractAddress: "0x1111aaaabbbbccccddddeeeeffffgggg2222hhhh" as AccountAddress, - questionType: QuestionType.Fixed, - title: "Should we implement EIP-1559?", - description: "Vote on whether to implement Ethereum Improvement Proposal 1559", - creator: "0x3333444455556666777788889999aaaabbbbcccc" as AccountAddress, - kickoff: 1625270400000 as Timestamp, - deadline: 1625875200000 as Timestamp, - isActive: true, - voteCount: 1500 - }, - user: { - canVote: true, - pointsAtDeadline: 950 - }, - options: [ - { - data: { - title: "Yes, implement EIP-1559", - description: "Support the implementation of EIP-1559 to improve gas fee predictability", - proposer: "0x7777888899990000aaaabbbbccccddddeeeefffff" as AccountAddress, - voteCount: 850, - pointsAtDeadline: 72000 - }, - user: { - voted: false - } - }, - { - data: { - title: "No, don't implement EIP-1559", - description: "Oppose the implementation of EIP-1559 due to concerns about miner revenue", - proposer: "0xbbbbccccddddeeeefffff00001111222233334444" as AccountAddress, - voteCount: 600, - pointsAtDeadline: 53000 - }, - user: { - voted: false - } - }, - { - data: { - title: "Delay implementation for further research", - description: "Postpone the decision on EIP-1559 to allow for more research and discussion", - proposer: "0xddddeeeefffff000011112222333344445555666" as AccountAddress, - voteCount: 50, - pointsAtDeadline: 4800 - }, - user: { - voted: false - } - } - ] -} - -// New Open question example -const exampleOpenQuestionQuery: QuestionView = { - data: { - contractAddress: "0x3333bbbbccccddddeeeeffffgggg4444iiii" as AccountAddress, - questionType: QuestionType.Open, - title: "What should be our next community project?", - description: "Propose and vote on ideas for our next community-driven project", - creator: "0x5555666677778888999900001111aaaabbbbcccc" as AccountAddress, - kickoff: 1630454400000 as Timestamp, - deadline: 1631664000000 as Timestamp, - isActive: true, - voteCount: 750 - }, - user: { - canVote: true, - pointsAtDeadline: 1200 - }, - options: [ - { - data: { - title: "Develop a decentralized social media platform", - description: "Create a censorship-resistant social network using blockchain technology", - proposer: "0x9999000011112222aaaabbbbccccddddeeeefffff" as AccountAddress, - voteCount: 300, - pointsAtDeadline: 45000 - }, - user: { - voted: false - } - }, - { - data: { - title: "Launch a community-owned NFT marketplace", - description: "Build an NFT marketplace where fees are distributed to community members", - proposer: "0xccccddddeeeefffff22223333444455556666777" as AccountAddress, - voteCount: 250, - pointsAtDeadline: 38000 - }, - user: { - voted: false - } - }, - { - data: { - title: "Create a DAO-governed grant program", - description: "Establish a grant program to fund innovative blockchain projects, governed by our DAO", - proposer: "0xeeeefffff000011112222333344445555666777" as AccountAddress, - voteCount: 200, - pointsAtDeadline: 30000 - }, - user: { - voted: false - } - } - ] -} - -console.log(JSON.stringify(exampleQuestionQuery, null, 2)) -console.log(JSON.stringify(exampleOpenQuestionQuery, null, 2))