Skip to content

Commit

Permalink
Merge branch 'main' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
rrr523 committed Dec 4, 2023
2 parents baa4591 + 493be54 commit e79ef17
Show file tree
Hide file tree
Showing 73 changed files with 6,942 additions and 3,411 deletions.
6 changes: 3 additions & 3 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ description: PNPM install deps
runs:
using: composite
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '18.17.0'
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

- name: Get pnpm store directory
Expand Down
29 changes: 29 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/packages/"
schedule:
interval: "weekly"
day: "sunday"
time: "16:00"
groups:
npm-dependencies:
patterns:
- "@npmcli/arborist"
- "nock"
- "npm"
- "semver"
exclude-patterns:
- "detect-indent" # temp excluded due to https://github.com/dependabot/dependabot-core/pull/5683#issuecomment-1243468605
pnpm-dependencies:
patterns:
- "@pnpm/lockfile-file"
- "@pnpm/dependency-path"
dev-dependencies:
dependency-type: "development"
update-types:
- "minor"
- "patch"
ignore:
- dependency-name: "npm"
update-types: ["version-update:semver-major"]
14 changes: 0 additions & 14 deletions .github/workflows/docs-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ jobs:
- name: Build
run: pnpm -F greenfield-js-sdk-docs build

# - uses: actions/setup-node@v3
# with:
# node-version: 18
# cache: yarn
# - uses: pnpm/action-setup@v2
# name: Install pnpm
# id: pnpm-install
# with:
# version: 7
# run_install: false

# - name: Install dependencies
# run: pnpm install

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/docs-test-deploy.yaml

This file was deleted.

10 changes: 4 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2
with:
version: 7
- run: pnpm install
persist-credentials: false

- uses: ./.github/actions/ci-setup

- run: pnpm -F "@bnb-chain/**" run lint
28 changes: 28 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test Case
on:
push:
branches:
- main
- alpha
- beta

jobs:
run-tests:
runs-on: ubuntu-latest

env:
ACCOUNT_ADDRESS: ${{ secrets.ACCOUNT_ADDRESS }}
ACCOUNT_PRIVATEKEY: ${{ secrets.ACCOUNT_PRIVATEKEY }}

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/ci-setup

- name: Build
run: pnpm -F "@bnb-chain/**" build

- name: Run Test
run: pnpm -F "@bnb-chain/greenfield-js-sdk" test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ You can use [`create-gnfd-app`](./packages/create-gnfd-app/README.md) to create
> pnpm install
```

2. Build package:
2. Build packages:
```bash
> pnpm run build
> pnpm -F "@bnb-chain/**" build
```

Look over [CONTRIBUTING](./CONTRIBUTING.md)
Expand Down
2 changes: 1 addition & 1 deletion doc-site/docs/client/greenfield.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const client = Client.create(GRPC_URL, GREEN_CHAIN_ID);
// Browser
const client = Client.create(GRPC_URL, String(GREEN_CHAIN_ID), {
zkCryptoUrl:
'https://unpkg.com/@bnb-chain/greenfield-zk-crypto@0.0.2-alpha.4/dist/node/zk-crypto.wasm',
'https://unpkg.com/@bnb-chain/greenfield-zk-crypto@1.0.0/dist/node/zk-crypto.wasm',
});
```

Expand Down
2 changes: 1 addition & 1 deletion doc-site/docs/client/query-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It's actually an encapsulation of the

:::info

In most cases, you probably don't need to use the Query Client` directly.
In most cases, you probably don't need to use the `Query Client` directly.

:::

Expand Down
5 changes: 3 additions & 2 deletions doc-site/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const { themes } = require('prism-react-renderer');
const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down
14 changes: 7 additions & 7 deletions doc-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@mdx-js/react": "^1.6.22",
"@docusaurus/core": "3.0.0",
"@docusaurus/preset-classic": "3.0.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"prism-react-renderer": "^2.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.1"
"@docusaurus/module-type-aliases": "3.0.0"
},
"browserslist": {
"production": [
Expand Down
48 changes: 48 additions & 0 deletions examples/nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# @demo/wallet

## 0.0.16

### Patch Changes

- Updated dependencies
[[`b97b305`](https://github.com/bnb-chain/greenfield-js-sdk/commit/b97b305ced1af7b9642f873be71167f673b84728)]:
- @bnb-chain/greenfiled-file-handle@1.0.2

## 0.0.15

### Patch Changes

- Updated dependencies
[[`5330912`](https://github.com/bnb-chain/greenfield-js-sdk/commit/5330912ee04935f7733e2453f75eca30f9cc7544)]:
- @bnb-chain/greenfiled-file-handle@1.0.1

## 0.0.14

### Patch Changes

- Updated dependencies
[[`5919a96`](https://github.com/bnb-chain/greenfield-js-sdk/commit/5919a9627491c62ee683a32e23c191146324a359)]:
- @bnb-chain/greenfield-js-sdk@1.0.6

## 0.0.13

### Patch Changes

- Updated dependencies
[[`f20db2a`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f20db2aaca603834dda619179f72c1a1e346090c)]:
- @bnb-chain/greenfield-js-sdk@1.0.5

## 0.0.12

### Patch Changes

- Updated dependencies
[[`1c24bde`](https://github.com/bnb-chain/greenfield-js-sdk/commit/1c24bdec7016c5338ae8a6e35a07876a3cb96998)]:
- @bnb-chain/greenfield-js-sdk@1.0.4

## 0.0.11

### Patch Changes

- Updated dependencies
[[`f14f3a1`](https://github.com/bnb-chain/greenfield-js-sdk/commit/f14f3a15b80c91b89d20aaf17ccdc8797418ad1c)]:
- @bnb-chain/greenfield-js-sdk@1.0.3

## 0.0.10

### Patch Changes
Expand Down
37 changes: 37 additions & 0 deletions examples/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@

Use [React](https://react.dev/) and [Next.js](https://nextjs.org/)

## Prepare

### install and build

Install dependencies:

```bash
pnpm install
```

Build package:

```bash
pnpm -F "@bnb-chain/**" build
```


### Run the demo application

`cp .env.simple .env` and fill your own configuration:

```bash
NEXT_PUBLIC_GRPC_URL=https://gnfd-testnet-fullnode-tendermint-us.bnbchain.org

NEXT_PUBLIC_GREENFIELD_RPC_URL=https://gnfd-testnet-ethapi-us.bnbchain.org
NEXT_PUBLIC_GREEN_CHAIN_ID=5600

# BSC End POINT
NEXT_PUBLIC_BSC_RPC_URL=https://gnfd-bsc-testnet-dataseed1.bnbchain.org
NEXT_PUBLIC_BSC_CHAIN_ID=5601
```

> this is TESTNET's configuration.

Run the demo application: `npm run dev`

## Usage case

* tx
Expand Down
16 changes: 8 additions & 8 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@demo/wallet",
"version": "0.0.10",
"version": "0.0.16",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development next dev",
Expand All @@ -14,31 +14,31 @@
"@bnb-chain/greenfield-cosmos-types": "0.4.0-alpha.23",
"@bnb-chain/greenfield-js-sdk": "workspace:*",
"@bnb-chain/greenfiled-file-handle": "workspace:*",
"@cosmjs/encoding": "^0.29.5",
"@cosmjs/proto-signing": "^0.29.5",
"@cosmjs/stargate": "^0.29.5",
"@cosmjs/encoding": "^0.32.0",
"@cosmjs/proto-signing": "^0.32.0",
"@cosmjs/stargate": "^0.32.0",
"@ethersproject/bytes": "5.7.0",
"@ethersproject/signing-key": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"@metamask/eth-sig-util": "^5.0.2",
"@next/font": "13.1.6",
"@rainbow-me/rainbowkit": "^1.0.5",
"@rainbow-me/rainbowkit": "^1.3.0",
"@types/node": "^18.7.1",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"axios": "^1.3.4",
"axios": "^1.6.2",
"cors": "^2.8.5",
"eslint": "^8.21.0",
"eslint-config-next": "13.1.6",
"evmosjs": "^0.2.17",
"lodash": "^4.17.21",
"long": "^5.2.1",
"next": "13.1.6",
"next": "14.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "^4.7.4",
"viem": "^1.0.6",
"wagmi": "^1.2.0"
"wagmi": "^1.4.7"
},
"devDependencies": {
"@types/lodash": "^4.14.199",
Expand Down
5 changes: 5 additions & 0 deletions examples/nextjs/src/components/object/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ACCOUNT_PRIVATEKEY } from '@/config/env';
import { getOffchainAuthKeys } from '@/utils/offchainAuth';
import { ChangeEvent, useState } from 'react';
import { useAccount } from 'wagmi';
import { getCheckSumsWorker } from '@bnb-chain/greenfiled-file-handle';

export const CreateObject = () => {
const { address, connector } = useAccount();
Expand Down Expand Up @@ -59,6 +60,10 @@ export const CreateObject = () => {
return;
}

const checksumWorker = getCheckSumsWorker();
const multiCal = await checksumWorker.generateCheckSumV2(file);
console.log('multiCal', multiCal);

const fileBytes = await file.arrayBuffer();
const hashResult = await (window as any).FileHandle.getCheckSums(
new Uint8Array(fileBytes),
Expand Down
6 changes: 6 additions & 0 deletions examples/nodejs/.env.simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ACCOUNT_ADDRESS='0x...'
ACCOUNT_PRIVATEKEY='0x...'

# testnet:
NEXT_PUBLIC_GREENFIELD_RPC_URL=https://gnfd-testnet-fullnode-tendermint-ap.bnbchain.org
NEXT_PUBLIC_GREEN_CHAIN_ID=5600
Loading

0 comments on commit e79ef17

Please sign in to comment.