Skip to content

Commit

Permalink
update frontend api & add deploy portal ci (rooch-network#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
wow-sven authored Apr 6, 2024
1 parent 8852953 commit abe587a
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 197 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy_portal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy Portal Frontend

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

steps:

- name: Deploy to GCP VM
env:
PRIVATE_KEY: ${{ secrets.GCP_SSH_PRIVATE_KEY }}
HOST: ${{ secrets.GCP_VM_HOST }}
USER: ${{ secrets.GCP_VM_USER }}
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST "cd /root/rooch && git pull origin main && pnpm install && pnpm rooch-sdk gen && pnpm rooch-sdk build && pnpm rooch-sdk-kit build && pnpm rooch-portal build && cd /root/rooch/rooch-portal-v1 && gsutil rsync -r out gs://rooch_portal"
179 changes: 2 additions & 177 deletions crates/rooch-open-rpc-spec/schemas/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,43 +632,6 @@
"$ref": "#/components/schemas/primitive_types::H256"
}
}
},
{
"name": "rooch_syncStates",
"description": "Sync state change sets from indexer",
"params": [
{
"name": "filter",
"schema": {
"$ref": "#/components/schemas/StateSyncFilterView"
}
},
{
"name": "cursor",
"schema": {
"$ref": "#/components/schemas/IndexerStateID"
}
},
{
"name": "limit",
"schema": {
"$ref": "#/components/schemas/usize"
}
},
{
"name": "descending_order",
"schema": {
"type": "boolean"
}
}
],
"result": {
"name": "IndexerTableChangeSetPageView",
"required": true,
"schema": {
"$ref": "#/components/schemas/PageView_for_IndexerTableChangeSetView_and_IndexerStateID"
}
}
}
],
"components": {
Expand Down Expand Up @@ -848,21 +811,6 @@
}
}
},
"DynamicFieldView": {
"type": "object",
"required": [
"k",
"v"
],
"properties": {
"k": {
"$ref": "#/components/schemas/KeyStateView"
},
"v": {
"$ref": "#/components/schemas/OpView_for_StateView"
}
}
},
"EventFilterView": {
"oneOf": [
{
Expand Down Expand Up @@ -1129,10 +1077,10 @@
"description": "Query by object id.",
"type": "object",
"required": [
"object"
"object_id"
],
"properties": {
"object": {
"object_id": {
"$ref": "#/components/schemas/ObjectID"
}
},
Expand Down Expand Up @@ -1387,39 +1335,6 @@
}
}
},
"IndexerTableChangeSetView": {
"type": "object",
"required": [
"created_at",
"state_index",
"table_change_set",
"table_handle",
"tx_order"
],
"properties": {
"created_at": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"state_index": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"table_change_set": {
"$ref": "#/components/schemas/TableChangeSetView"
},
"table_handle": {
"$ref": "#/components/schemas/ObjectID"
},
"tx_order": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
},
"InscriptionFilterView": {
"oneOf": [
{
Expand Down Expand Up @@ -2271,35 +2186,6 @@
}
}
},
"PageView_for_IndexerTableChangeSetView_and_IndexerStateID": {
"description": "`next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first item.",
"type": "object",
"required": [
"data",
"has_next_page"
],
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IndexerTableChangeSetView"
}
},
"has_next_page": {
"type": "boolean"
},
"next_cursor": {
"anyOf": [
{
"$ref": "#/components/schemas/IndexerStateID"
},
{
"type": "null"
}
]
}
}
},
"PageView_for_InscriptionStateView_and_IndexerStateID": {
"description": "`next_cursor` points to the last item in the page; Reading with `next_cursor` will start from the next item after `next_cursor` if `next_cursor` is `Some`, otherwise it will start from the first item.",
"type": "object",
Expand Down Expand Up @@ -2499,23 +2385,6 @@
}
}
},
"StateSyncFilterView": {
"oneOf": [
{
"description": "Query by table handle.",
"type": "object",
"required": [
"table_handle"
],
"properties": {
"table_handle": {
"$ref": "#/components/schemas/ObjectID"
}
},
"additionalProperties": false
}
]
},
"StateView": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2551,50 +2420,6 @@
}
}
},
"TableChangeSetView": {
"type": "object",
"required": [
"changes",
"new_tables",
"removed_tables"
],
"properties": {
"changes": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/TableChangeView"
}
},
"new_tables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ObjectID"
},
"uniqueItems": true
},
"removed_tables": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ObjectID"
},
"uniqueItems": true
}
}
},
"TableChangeView": {
"type": "object",
"required": [
"entries"
],
"properties": {
"entries": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DynamicFieldView"
}
}
}
},
"TransactionExecutionInfoView": {
"type": "object",
"required": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"dashboard": "pnpm --filter ./dashboard",
"rooch-portal-v1": "pnpm --filter ./rooch-portal-v1",
"rooch-portal": "pnpm --filter ./rooch-portal-v1",
"rooch-create": "pnpm --filter ./sdk/typescript/rooch-create/",
"rooch-sdk": "pnpm --filter ./sdk/typescript/rooch-sdk/",
"rooch-sdk-kit": "pnpm --filter ./sdk/typescript/rooch-sdk-kit/",
Expand Down
2 changes: 1 addition & 1 deletion rooch-portal-v1/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function App() {
<>
<CacheProvider value={clientSideEmotionCache}>
<QueryClientProvider client={queryClient}>
<RoochClientProvider defaultNetwork={TestNetwork}>
<RoochClientProvider network={TestNetwork}>
<WalletProvider chain={SupportChain.BITCOIN} autoConnect>
<ThemeProvider defaultTheme="light" storageKey="vite-ui-theme">
<ToastProvider />
Expand Down
2 changes: 1 addition & 1 deletion rooch-portal-v1/src/components/wallet-connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const WalletConnect = () => {
const { mutateAsync: connectWallet } = useConnectWallet()
const account = useWalletStore((state) => state.currentAccount)
const [currentWallet, setCurrentWallet] = useState<BaseWallet | null>(null)
const wallets = useWallets().filter((wallet) => wallet.isSupportChain(SupportChain.BITCOIN))
const wallets = useWallets().filter((wallet) => wallet.getChain() === SupportChain.BITCOIN)

// ** Connect wallet
const handleConnectWallet = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export const TransactionsTable = () => {
</TableCell>
<TableCell>
<Badge variant="outline" className="text-muted-foreground">
{tx.transaction.action_type.toUpperCase()}
// TODO: https://github.com/rooch-network/rooch/issues/1524
{/*{tx.transaction.data}*/}
</Badge>
</TableCell>
<TableCell>
Expand Down
31 changes: 24 additions & 7 deletions sdk/typescript/rooch-sdk/src/client/roochClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import {
bcs,
EventOptions,
EventPageView,
GlobalStateView,
InscriptionStatePageView,
EventWithIndexerPageView,
StateOptions,
StatePageView,
StateView,
TableStateView,
TransactionWithInfoPageView,
TransactionWithInfoView,
UTXOStatePageView,
BalanceInfoPageView,
IPage,
ObjectStateView,
FieldStateView,
} from '../types'
import {
addressToListTuple,
Expand All @@ -39,9 +39,7 @@ import {
ExecuteViewFunctionParams,
GetEventsParams,
GetTransactionsParams,
QueryGlobalStatesParams,
QueryInscriptionsParams,
QueryTableStatesParams,
QueryUTXOsParams,
ResoleRoochAddressParams,
ListStatesParams,
Expand All @@ -51,6 +49,8 @@ import {
GetBalancesParams,
SessionInfo,
SendTransactionDataParams,
QueryObjectStatesParams,
QueryFieldStatesParams,
} from './roochClientTypes'

import {
Expand Down Expand Up @@ -252,7 +252,6 @@ export class RoochClient {
return await this.client.rooch_getStates(access_path, { decode: true } as StateOptions)
}

// TODO: bug? next_cursor The true type is string
async listStates(params: ListStatesParams): Promise<StatePageView> {
return await this.client.rooch_listStates(
params.accessPath,
Expand All @@ -264,7 +263,7 @@ export class RoochClient {
)
}

async queryGlobalStates(params: QueryGlobalStatesParams): Promise<GlobalStateView> {
async queryGlobalStates(params: QueryObjectStatesParams): Promise<ObjectStateView> {
return await this.client.rooch_queryGlobalStates(
params.filter,
params.cursor as any,
Expand All @@ -273,7 +272,25 @@ export class RoochClient {
)
}

async queryTableStates(params: QueryTableStatesParams): Promise<TableStateView> {
async queryObjectStates(params: QueryObjectStatesParams): Promise<ObjectStateView> {
return await this.client.rooch_queryObjectStates(
params.filter,
params.cursor as any,
params.limit.toString(),
params.descending_order,
)
}

async queryFieldStates(params: QueryFieldStatesParams): Promise<FieldStateView> {
return await this.client.rooch_queryFieldStates(
params.filter,
params.cursor as any,
params.limit.toString(),
params.descending_order,
)
}

async queryTableStates(params: QueryFieldStatesParams): Promise<FieldStateView> {
return await this.client.rooch_queryTableStates(
params.filter,
params.cursor as any,
Expand Down
Loading

0 comments on commit abe587a

Please sign in to comment.