From 6f03e7fea5609573d880698db227798b81433dd7 Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Fri, 26 Feb 2021 16:30:27 +0900 Subject: [PATCH 1/2] Add schema --- schema.graphql | 830 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 830 insertions(+) create mode 100644 schema.graphql diff --git a/schema.graphql b/schema.graphql new file mode 100644 index 000000000..af0bd3668 --- /dev/null +++ b/schema.graphql @@ -0,0 +1,830 @@ +schema { + query: StandaloneQuery + mutation: StandaloneMutation + subscription: StandaloneSubscription +} + +type StandaloneQuery { + # Check if the provided address is activated. + activationStatus: ActivationStatusQuery! + getTx( + # transaction id. + txId: TxId! + ): TransactionType_1 + goldBalance( + # Target address to query + address: Address! + + # Offset block hash for query. + hash: ByteString + ): String! + keyStore: KeyStoreType + nextTxNonce( + # Target address to query + address: Address! + ): Long! + nodeStatus: NodeStatusType! + + # Get the peer's block chain state + peerChainState: PeerChainStateQuery! + state( + # The address of state to fetch from the chain. + address: Address! + + # The hash of the block used to fetch state from chain. + hash: ByteString + ): ByteString + stateQuery( + # Offset block hash for query. + hash: ByteString + ): StateQuery! + + # The validation method provider for Libplanet types. + validation: ValidationQuery! +} + +# An delegate to provide read-only view of account states. +# Gets an account state of the given +# .If the given has never been set +# its account status, returns null instead of throwing +# any exception. +type StateQuery { + # State for agent. + agent( + # Address of agent. + address: Address! + ): AgentStateType + + # State for avatar. + avatar( + # Address of avatar. + address: Address + ): AvatarStateType + + # State for avatar EXP record. + rankingMap( + # RankingMapState index. 0 ~ 99 + index: Int! + ): RankingMapStateType + + # State for shop. + shop: ShopStateType + + # State for weekly arena. + weeklyArena( + # WeeklyArenaState index. It increases every 56,000 blocks. + index: Int! + ): WeeklyArenaStateType +} + +type AvatarStateType { + # Current ActionPoint. + actionPoint: Int! + + # Address of avatar. + address: Address! + + # Address of agent. + agentAddress: Address! + + # Block index at the latest executed action. + blockIndex: Int! + + # Character ID from CharacterSheet. + characterId: Int! + + # Address list of combination slot. + combinationSlotAddresses: [Address!]! + + # Block index at the DailyReward execution. + dailyRewardReceivedIndex: Long! + + # Index of ear color. + ear: Int! + + # List of quest event ID. + eventMap: CollectionMapType! + + # Avatar total EXP. + exp: Int! + + # Index of hair color. + hair: Int! + + # Avatar inventory. + inventory: InventoryType! + + # List of acquired item ID. + itemMap: CollectionMapType! + + # Index of eye color. + lens: Int! + + # Avatar Level. + level: Int! + + # List of mail. + mailBox: MailBoxType! + + # List of defeated monster ID. + monsterMap: CollectionMapType! + + # Avatar name. + name: String! + + # List of quest. + questList: QuestListType! + + # Address of the RankingMapState where this avatar information is recorded. + rankingMapAddress: Address! + + # List of cleared stage ID. + stageMap: CollectionMapType! + + # Index of tail color. + tail: Int! + + # Block index at the latest executed action. + updatedAt: Long! + + # World & Stage information. + worldInformation: WorldInformationType! +} + +scalar Address + +scalar Long + +type InventoryType { + # List of Consumables. + consumables: [ConsumableType!]! + + # List of Costumes. + costumes: [CostumeType!]! + + # List of Equipments. + equipments: [EquipmentType!]! + + # List of Materials. + materials: [MaterialType!]! +} + +type ConsumableType { + # Item elemental. + elementalType: ElementalType! + + # Grade from ItemSheet. + grade: Int! + + # ID from ItemSheet. + id: Int! + itemId: Guid! + + # Item subcategory. + itemSubType: ItemSubType! + + # Item category. + itemType: ItemType! + mainStat: StatType! +} + +enum ItemType { + CONSUMABLE + COSTUME + EQUIPMENT + MATERIAL +} + +enum ItemSubType { + FOOD + FULL_COSTUME + HAIR_COSTUME + EAR_COSTUME + EYE_COSTUME + TAIL_COSTUME + WEAPON + ARMOR + BELT + NECKLACE + RING + EQUIPMENT_MATERIAL + FOOD_MATERIAL + MONSTER_PART + NORMAL_MATERIAL + HOURGLASS + AP_STONE + CHEST + TITLE +} + +enum ElementalType { + NORMAL + FIRE + WATER + LAND + WIND +} + +scalar Guid + +enum StatType { + NONE + HP + ATK + DEF + CRI + HIT + SPD +} + +type MaterialType { + # Item elemental. + elementalType: ElementalType! + + # Grade from ItemSheet. + grade: Int! + + # ID from ItemSheet. + id: Int! + itemId: ByteString! + + # Item subcategory. + itemSubType: ItemSubType! + + # Item category. + itemType: ItemType! +} + +scalar ByteString + +type EquipmentType { + # Item elemental. + elementalType: ElementalType! + equipped: Boolean! + + # Grade from ItemSheet. + grade: Int! + + # ID from ItemSheet. + id: Int! + itemId: Guid! + + # Item subcategory. + itemSubType: ItemSubType! + + # Item category. + itemType: ItemType! + setId: Int! + stat: DecimalStatType! +} + +type DecimalStatType { + type: StatType! + value: Decimal! +} + +scalar Decimal + +type CostumeType { + # Item elemental. + elementalType: ElementalType! + + # Status of Avatar equipped. + equipped: Boolean! + + # Grade from ItemSheet. + grade: Int! + + # ID from ItemSheet. + id: Int! + + # Guid of costume. + itemId: Guid! + + # Item subcategory. + itemSubType: ItemSubType! + + # Item category. + itemType: ItemType! +} + +type CollectionMapType { + count: Int! + pairs: [[Int]!]! +} + +type QuestListType { + completedQuestIds: [Int!]! +} + +type MailBoxType { + count: Int! + mails: [MailType!]! +} + +type MailType { + blockIndex: Long! + id: Guid! + requiredBlockIndex: Long! +} + +type WorldInformationType { + isStageCleared(stageId: Int!): Boolean! + isWorldUnlocked(worldId: Int!): Boolean! + world(worldId: Int!): WorldType! +} + +type WorldType { + id: Int! + isStageCleared: Boolean! + isUnlocked: Boolean! + name: String! + stageBegin: Int! + stageClearedBlockIndex: Long! + stageClearedId: Int! + stageEnd: Int! + unlockedBlockIndex: Long! +} + +type RankingMapStateType { + # Address of RankingMapState. + address: Address! + + # RankingMapState Capacity. + capacity: Int! + + # List of RankingInfo. + rankingInfos: [RankingInfoType!]! +} + +type RankingInfoType { + # Address of agent. + agentAddress: Address! + + # Equipped Armor ID from EquipmentItemSheet. + armorId: Int! + + # Address of avatar. + avatarAddress: Address! + + # Avatar name. + avatarName: String! + + # Avatar total EXP. + exp: Long! + + # Avatar Level. + level: Int! + + # Block index at Latest stage cleared. + stageClearedBlockIndex: Long! + + # Block index at RankingInfo update. + updatedAt: Long! +} + +type ShopStateType { + # Address of shop. + address: Address! + + # List of ShopItem. + products( + # Filter for item id. + id: Int + + # Filter for ItemSubType. see from https://github.com/planetarium/lib9c/blob/main/Lib9c/Model/Item/ItemType.cs#L13 + itemSubType: ItemSubType + + # Filter for item maximum price. + maximumPrice: Int + ): [ShopItemType]! +} + +type ShopItemType { + # Costume information. + costume: CostumeType + + # Equipment / Consumable information. + itemUsable: ItemUsableType + + # Item price. + price: String! + + # Guid of product registered. + productId: Guid! + + # Address of seller agent. + sellerAgentAddress: Address! + + # Address of seller avatar. + sellerAvatarAddress: Address! +} + +type ItemUsableType { + # Item elemental. + elementalType: ElementalType! + + # Grade from ItemSheet. + grade: Int! + + # ID from ItemSheet. + id: Int! + + # Guid of item. + itemId: Guid! + + # Item subcategory. + itemSubType: ItemSubType! + + # Item category. + itemType: ItemType! +} + +type WeeklyArenaStateType { + address: Address! + ended: Boolean! + orderedArenaInfos: [ArenaInfoType]! +} + +type ArenaInfoType { + active: Boolean! + agentAddress: Address! + arenaRecord: ArenaRecordType! + armorId: Int! + avatarAddress: Address! + avatarName: String! + combatPoint: Int! + dailyChallengeCount: Int! + level: Int! + score: Int! +} + +type ArenaRecordType { + draw: Int + lose: Int + win: Int +} + +type AgentStateType { + # Address of agent. + address: Address! + + # Address list of avatar. + avatarAddresses: [Address!] + + # Current NCG. + gold: String! +} + +# The interface to store s. An appropriate implementation +# should be used according to a running platform. +type KeyStoreType { + decryptedPrivateKey(address: Address!, passphrase: String!): ByteString! + + # An API to provide conversion to public-key, address. + privateKey( + # A representation of public-key with hexadecimal format. + hex: ByteString! + ): PrivateKeyType! + protectedPrivateKeys: [ProtectedPrivateKeyType!]! +} + +# Protects a with a passphrase (i.e., password). +type ProtectedPrivateKeyType { + address: Address! +} + +# A secret part of a key pair involved in +# ECDSA, the digital +# signature algorithm on which the Libplanet is based. It can be used to +# create signatures, which can be verified with the corresponding +# , as well as to decrypt +# messages which were encrypted with the corresponding +# . +# Note that it uses secp256k1 as the parameters of the elliptic curve, which is +# the same to Bitcoin and +# Ethereum. +# It means private keys generated for Bitcoin/Ethereum can be used by +# Libplanet-backed games/apps too. +type PrivateKeyType { + # A representation of private-key with hexadecimal format. + hex: ByteString! + + # A public-key derived from the private-key. + publicKey: PublicKeyType! +} + +# A public part of a key pair involved in +# ECDSA, the digital +# signature algorithm on which the Libplanet is based. +# It can be used to verify signatures created with the corresponding +# and to encrypt messages for someone +# possessing the corresponding . +# This can be distributed publicly, hence the name. +# Note that it uses secp256k1 as the parameters of the elliptic curve, which is same to +# Bitcoin and +# Ethereum. +# It means public keys generated for Bitcoin/Ethereum can be used by +# Libplanet-backed games/apps too. +type PublicKeyType { + # An address derived from the public-key. + address: Address! + + # A representation of public-key with hexadecimal format. + hex( + # A flag to determine whether to compress public-key. + compress: Boolean + ): ByteString! +} + +type NodeStatusType { + bootstrapEnded: Boolean! + genesis: BlockHeader! + + # Whether it is mining. + isMining: Boolean! + preloadEnded: Boolean! + + # Staged TxIds from the current node. + stagedTxIds( + # Target address to query + address: Address + ): [TxId] + tip: BlockHeader! + + # The topmost blocks from the current node. + topmostBlocks( + # The number of blocks to get. + limit: Int! + + # List only blocks mined by the given address. (List everything if omitted.) + miner: Address + ): [BlockHeader]! +} + +type BlockHeader { + hash: String! + id: ID! + index: Int! + miner: Address +} + +scalar TxId + +type ValidationQuery { + metadata( + # The raw value of json metadata. + raw: String! + ): Boolean! + privateKey( + # The raw value of private-key, presented as hexadecimal. + hex: ByteString! + ): Boolean! + publicKey( + # The raw value of public-key, presented as hexadecimal. + hex: ByteString! + ): Boolean! +} + +type ActivationStatusQuery { + activated: Boolean! +} + +type PeerChainStateQuery { + state: [String]! +} + +type TransactionType_1 { + actions: [Action]! + id: TxId! + nonce: Long! + publicKey: PublicKeyType! + signature: ByteString! + signer: Address! + timestamp: String! + updatedAddresses: [Address]! +} + +type Action { + plainValue: String! +} + +type StandaloneMutation { + action: ActionMutation + activationStatus: ActivationStatusMutation + keyStore: KeyStoreMutation + + # Add a new transaction to staging + stageTx( + # Hex-encoded bytes for new transaction. + payload: String! + ): Boolean! + transferGold(recipient: Address!, amount: String!): TxId +} + +# The interface to store s. An appropriate implementation +# should be used according to a running platform. +type KeyStoreMutation { + createPrivateKey(passphrase: String!, privateKey: ByteString): PrivateKeyType! + revokePrivateKey(address: Address!): ProtectedPrivateKeyType! +} + +type ActivationStatusMutation { + activateAccount(encodedActivationKey: String!): Boolean! +} + +type ActionMutation { + # Buy registered shop item. + buy( + # Agent address from registered ShopItem. + sellerAgentAddress: Address! + + # Avatar address from registered ShopItem. + sellerAvatarAddress: Address! + + # Avatar address. + buyerAvatarAddress: Address! + + # ShopItem product ID. + productId: Guid! + ): TxId! + + # Combine new Consumable. + combinationConsumable( + # Avatar address to combine consumable. + avatarAddress: Address! + + # ConsumableRecipe ID from ConsumableRecipeSheet. + recipeId: Int! + + # The empty combination slot index to combine consumable. 0 ~ 3 + slotIndex: Int! + ): TxId! + + # Combine new equipment. + combinationEquipment( + # Avatar address to create equipment. + avatarAddress: Address! + + # EquipmentRecipe ID from EquipmentRecipeSheet. + recipeId: Int! + + # The empty combination slot index to combine equipment. 0 ~ 3 + slotIndex: Int! + + # EquipmentSubRecipe ID from EquipmentSubRecipeSheet. + subRecipeId: Int + ): TxId! + + # Create new avatar. + createAvatar( + # Avatar name. + avatarName: String! + + # The index of character slot. 0 ~ 2 + avatarIndex: Int! + + # The index of character hair color. 0 ~ 8 + hairIndex: Int! + + # The index of character eye color. 0 ~ 8 + lensIndex: Int! + + # The index of character ear color. 0 ~ 8 + earIndex: Int! + + # The index of character tail color. 0 ~ 8 + tailIndex: Int! + ): TxId! + + # Get daily reward. + dailyReward( + # Avatar address to receive reward. + avatarAddress: Address! + ): TxId! + + # Start stage to get material. + hackAndSlash( + # Avatar address. + avatarAddress: Address! + + # World ID containing the stage ID. + worldId: Int! + + # Stage ID. + stageId: Int! + + # Address of this WeeklyArenaState + weeklyArenaAddress: Address! + + # Address of RankingMapState containing the avatar address. + rankingArenaAddress: Address! + + # List of costume id for equip. + costumeIds: [Guid] + + # List of equipment id for equip. + equipmentIds: [Guid] + + # List of consumable id for use. + consumableIds: [Guid] + ): TxId! + + # Upgrade equipment. + itemEnhancement( + # Avatar address to upgrade equipment. + avatarAddress: Address! + + # Equipment Guid for upgrade. + itemId: Guid! + + # Material Guid for equipment upgrade. + materialId: Guid! + + # The empty combination slot index to upgrade equipment. 0 ~ 3 + slotIndex: Int! + ): TxId! + + # Register item to the shop. + sell( + # Avatar address to register shop item. + sellerAvatarAddress: Address! + + # Item Guid to register on shop. + itemId: Guid! + + # Item selling price. + price: Int! + ): TxId! +} + +type StandaloneSubscription { + differentAppProtocolVersionEncounter: DifferentAppProtocolVersionEncounterType! + nodeException: NodeExceptionType! + nodeStatus: NodeStatusType + notification: NotificationType! + preloadProgress: PreloadStateType + tipChanged: TipChanged +} + +type TipChanged { + hash: ByteString + index: Long! +} + +type PreloadStateType { + currentPhase: Long! + extra: PreloadStateExtraType! + totalPhase: Long! +} + +type PreloadStateExtraType { + currentCount: Long! + totalCount: Long! + type: String! +} + +type DifferentAppProtocolVersionEncounterType { + localVersion: AppProtocolVersionType! + peer: String! + peerVersion: AppProtocolVersionType! +} + +# A claim of a version. +# Every peer in network shows others their information. +# As every peer can change its software by itself, this +# is theoretically arbitrary, hence a “claim.” (i.e., no authority).In order to verify who claimed a version, every +# has its which is made by its . +# method purposes to determine whether an information +# is claimed by its corresponding in fact. +type AppProtocolVersionType { + extra: ByteString + signature: ByteString! + signer: Address! + version: Int! +} + +type NotificationType { + # The message of Notification. + message: String + + # The type of Notification. + type: NotificationEnum! +} + +enum NotificationEnum { + REFILL + HAS + COMBINATION_EQUIPMENT + COMBINATION_CONSUMABLE + BUYER + SELLER +} + +type NodeExceptionType { + # The code of NodeException. + code: Int! + + # The message of NodeException. + message: String! +} From ca09f10f20319dcd8efd7f4ea500ede800d3dc5e Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Fri, 26 Feb 2021 16:31:56 +0900 Subject: [PATCH 2/2] Add deploy gh pages action --- .github/workflows/deploy_gh_pages.yml | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/deploy_gh_pages.yml diff --git a/.github/workflows/deploy_gh_pages.yml b/.github/workflows/deploy_gh_pages.yml new file mode 100644 index 000000000..7af2f53c7 --- /dev/null +++ b/.github/workflows/deploy_gh_pages.yml @@ -0,0 +1,37 @@ +name: Deploy gh pages +on: + push: + branches: + - development +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + submodules: recursive + node-version: '14' + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies + run: npm install -g @2fd/graphdoc + - name: Build + run: graphdoc -s schema.graphql -o doc + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./doc