Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adds deployment pipeline for sdk docs #7

Merged
merged 11 commits into from
May 10, 2024
7 changes: 7 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"projects": {
"default": "zksync-sdk-docs-staging",
"prod": "sdk-docs-7b113"
},
"etags": {}
}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "preview builder πŸ‘€"
on:
pull_request:
workflow_dispatch:

jobs:
build_and_preview:
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
NUXT_PUBLIC_SITE_URL: ${{ secrets.NUXT_PUBLIC_SITE_URL }}
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
outputs:
output_urls: "${{ steps.preview_deploy.outputs.urls }}"
steps:
- uses: actions/checkout@v4 # v4

- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install

- name: "Deploy target: staging"
run: bun run generate

- uses: untitaker/[email protected]
with:
args: .output/public/ --sources content/

- name: "Deploy preview"
uses: matter-labs/action-hosting-deploy@main
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZKSYNC_SDK_DOCS_STAGING }}"
projectId: zksync-sdk-docs-staging
45 changes: 45 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "deploy πŸš€"
on:
push:
branches: [main]

jobs:
build_and_deploy:
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
if: ${{ github.event.repository.full_name == github.repository }}
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4 # v4
with:
fetch-depth: 0
# Whether to configure the token or SSH key with the local git config
# Default: true
persist-credentials: false # <--- checking this in commit context

- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
- name: "Deploy target: staging"
run: bun run generate
# TODO: ask about below
# env:
# RUDDERSTACK_WRITE_KEY: "${{ secrets.RUDDERSTACK_WRITE_KEY }}"
# RUDDERSTACK_DATA_PLANE_URL: "${{ secrets.RUDDERSTACK_DATA_PLANE_URL }}"

- uses: matter-labs/action-hosting-deploy@main
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SDK_DOCS_7B113 }}"
target: prod
projectId: sdk-docs-7b113
channelId: live

# TODO: Implement reindex task tracking instead of blindly exiting on task submit
# - name: Trigger Algolia reindex
# run: |
# curl -X POST "${{ secrets.ALGOLIA_CRAWLER_BASE_URL }}/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex" \
# -H "Content-Type: application/json" \
# --user "${{ secrets.ALGOLIA_CRAWLER_USER_ID }}:${{ secrets.ALGOLIA_CRAWLER_API_KEY }}"
30 changes: 30 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "deploy staging πŸ—οΈ"
on:
push:
branches: [staging]

jobs:
build_and_deploy:
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
NUXT_PUBLIC_SITE_URL: ${{ secrets.NUXT_PUBLIC_SITE_URL }}
if: ${{ github.event.repository.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # v4
with:
ref: "${{ github.event.inputs.ref }}"

- uses: oven-sh/setup-bun@v1

- name: "Install dependencies"
run: bun install
- name: "Deploy target: staging"
run: bun run generate

- uses: matter-labs/action-hosting-deploy@main
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ZKSYNC_SDK_DOCS_STAGING }}"
projectId: zksync-sdk-docs-staging
channelId: live
2 changes: 0 additions & 2 deletions content/sdk/00.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ These SDKs, available in various programming languages, streamline the process o
- Enhances security and privacy by separating user accounts from keys.
- Improves developer experience by simplifying account management and enabling features
like multi-signature wallets and on-chain governance.

![docs](/images/sdk/docs.png)
6 changes: 3 additions & 3 deletions content/sdk/10.js/00.ethers/v5/00.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const ethProvider = ethers.getDefaultProvider("sepolia");
```

Get the network (helper function [toJSON](./providers.md#tojson)):
Get the network (helper function [toJSON](./03.providers.md#tojson)):

```ts
console.log(`Network: ${toJSON(await provider.getNetwork())}`);
Expand All @@ -60,13 +60,13 @@ Get the latest block number:
console.log(`Block number: ${await provider.getBlockNumber()}`);
```

Get the block by hash (helper function [toJSON](./providers.md#tojson)):
Get the block by hash (helper function [toJSON](./03.providers.md#tojson)):

```ts
console.log(`Block: ${toJSON(await provider.getBlock("b472c070c9e121ba42702f6c322b7b266e287a4d8b5fa426ed265b105430c397", true))}`);
```

Get the transaction by hash (helper function [toJSON](./providers.md#tojson)):
Get the transaction by hash (helper function [toJSON](./03.providers.md#tojson)):

```ts
console.log(`Block: ${toJSON(await provider.getTransaction("0x9af27afed9a4dd018c0625ea1368afb8ba08e4cfb69b3e76dfb8521c8a87ecfc"))}`);
Expand Down
10 changes: 5 additions & 5 deletions content/sdk/10.js/00.ethers/v5/01.features.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ While zkSync is mostly Web3-compatible, it has some differences compared to Ethe

These require us to extend standard Ethereum transactions with new custom fields. Such extended transactions
are called EIP712 transactions since [EIP712](https://eips.ethereum.org/EIPS/eip-712) is used to sign them.
You can look at the internal structure of the EIP712 transactions [here](https://docs.zksync.io/zk-stack/concepts/transaction-lifecycle.md#eip-712-0x71).
You can look at the internal structure of the EIP712 transactions [here](https://docs.zksync.io/zk-stack/concepts/transaction-lifecycle.html#eip-712-0x71).

This document will focus solely on how to pass these arguments to the SDK.

Expand Down Expand Up @@ -78,17 +78,17 @@ Use custom signature `0x123456` for account, while using paymaster with address

While the paymaster feature by itself does not impose any limitations on values of the
`paymasterInput`, the Matter Labs team endorses certain types of
[paymaster flows](https://docs.zksync.io/build/developer-reference/account-abstraction.md#built-in-paymaster-flows)
[paymaster flows](https://docs.zksync.io/build/developer-reference/account-abstraction.html#built-in-paymaster-flows)
that are processable by EOAs.

zkSync SDK provides a utility method that can be used to get the correctly formed `paymasterParams` object:
[getPaymasterParams](./paymaster-utils.md#getpaymasterparams).
[getPaymasterParams](./08.paymaster-utils.md#getpaymasterparams).

## See in action

If you want to call the method `setGreeting` of an ethers `Contract` object called `greeter`,
this would look the following way, while paying fees with the
[testnet paymaster](https://docs.zksync.io/build/developer-reference/account-abstraction.md#testnet-paymaster):
[testnet paymaster](https://docs.zksync.io/build/developer-reference/account-abstraction.html#testnet-paymaster):

```ts
// The `setGreeting` method has a single parameter -- new greeting
Expand Down Expand Up @@ -117,5 +117,5 @@ const sentTx = await sender.sendTransaction({
});
```

You can also check out our [tutorial](https://docs.zksync.io/build/quick-start/hello-world.md) on the
You can also check out our [tutorial](https://docs.zksync.io/build/quick-start/hello-world.html) on the
full-fledged mini-dApp, where users can choose token to pay the fee.
4 changes: 2 additions & 2 deletions content/sdk/10.js/00.ethers/v5/02.front-end.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All the existing SDKs/infrastructure will work out-of-box.
## Enabling zkSync features

If you want to deploy smart contracts or enable advanced zkSync features, like account abstraction,
then you need to use the `zksync-ethers` library. You can read about the basics [here](./features.md).
then you need to use the `zksync-ethers` library. You can read about the basics [here](./01.features.md).

If you want to see some code, check out our basic [tutorial](https://docs.zksync.io/build/quick-start/hello-world.md)
If you want to see some code, check out our basic [tutorial](https://docs.zksync.io/build/quick-start/hello-world.html)
for full mini-dApp.
Loading
Loading