From 46a348f7b926d7d645a76f839ea9228a55807507 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sat, 8 Feb 2025 17:10:36 +0100 Subject: [PATCH 1/6] web4 page --- docs/web4.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/web4.md diff --git a/docs/web4.md b/docs/web4.md new file mode 100644 index 0000000..eb5fb4d --- /dev/null +++ b/docs/web4.md @@ -0,0 +1,5 @@ +# Web4 + +```bash +near contract call-function as-transaction social.near set json-args '{"data": {"webassemblymusic-treasury.near": {"widget": {"app": {"metadata": {"name": "WebAssembly Music", "description": "Treasury for the WebAssembly Music project"}}}}}}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as webassemblymusic-treasury.near network-config mainnet +``` From d6d82e6bc199c95c147c50d290b98b61025e15a4 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sun, 9 Feb 2025 16:36:05 +0100 Subject: [PATCH 2/6] about updating the web4 contract --- docs/web4.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/web4.md b/docs/web4.md index eb5fb4d..f049a00 100644 --- a/docs/web4.md +++ b/docs/web4.md @@ -1,5 +1,33 @@ # Web4 +Instances created by the treasury factory, will get two accounts: + +- `.sputnik-dao.near` +- `.near` + +The first account will have the sputnik-dao contract deployed, and the second will get a web4 contract. [Web4](https://github.com/vgrichina/web4) contracts acts as a web server, so that you can get a dedicated page for your treasury in addition to gateways like https://near.social or https://dev.near.org. You can find the web4 page for your treasury at https://.near.page. + +## Updating the web4 contract + +The [web4 contract for the treasury app](https://github.com/NEAR-DevHub/neardevhub-treasury-dashboard/tree/staging/web4/treasury-web4), is under constant development, and there may be newer versions available since your treasury instance was created. + +If you wish to update your web4 contract to the latest version you can download the WebAssembly ( `.wasm` ) file from the account `treasury-testing.near`. + +The easiest way to download the contract wasm is using [near-cli-rs](https://github.com/near/near-cli-rs), which you should install first if you don't already have it. + +Once installed you can type the following in a terminal to download the `treasury-web4.wasm` file. + ```bash -near contract call-function as-transaction social.near set json-args '{"data": {"webassemblymusic-treasury.near": {"widget": {"app": {"metadata": {"name": "WebAssembly Music", "description": "Treasury for the WebAssembly Music project"}}}}}}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as webassemblymusic-treasury.near network-config mainnet +near contract download-wasm treasury-testing.near save-to-file treasury-web4.wasm network-config mainnet now ``` + +The next step is to deploy the contract to your treasury account. You can do this by typing the following (remember to replace `` with your own treasury account name): + +```bash +near contract deploy .near use-file treasury-web4.wasm without-init-call network-config mainnet +``` + +## Setting metadata + + + From 18723c3824fe14ebd171a20ff6c8a65d359213fb Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sun, 9 Feb 2025 16:55:43 +0100 Subject: [PATCH 3/6] Update web4.md docs about setting metadata --- docs/web4.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/web4.md b/docs/web4.md index f049a00..df49f77 100644 --- a/docs/web4.md +++ b/docs/web4.md @@ -27,7 +27,25 @@ The next step is to deploy the contract to your treasury account. You can do thi near contract deploy .near use-file treasury-web4.wasm without-init-call network-config mainnet ``` +Follow the instructions to sign the transaction using your preferred way of signing. You may access the web4 account with the same key that you used to create the treasury. + ## Setting metadata +A feature of web4 is to provide metadata for social link previews. The treasury factory will set some defaults when creating the treasury, but you may set your own metadata by calling the `set_social_metadata` function of the web4 contract. + +Here is an example that was used to set metadata for the treasury created at https://webassemblymusic-treasury.near.page ( remember to replace `webassemblymusic-treasury.near` with your treasury web4 account name. + +```bash +near contract call-function as-transaction webassemblymusic-treasury.near set_social_metadata json-args '{"name": "WebAssembly Music NEAR treasury", "description": "NEAR Treasury for the WebAssembly Music project", "ipfs_cid": "bafybeihsid3qgrb2dd4adsd4kuwe3pondtjr3u27ru6e2mbvabvm4rocru"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as webassemblymusic-treasury.near network-config mainnet +``` + +If you then share the link to https://webassemblymusic-treasury.near.page, you will get the following preview when e.g. using Twitter/X: + +image + +The metadata you set here will also be available for preview links via the near.social gateway. Here's how it looks like when sharing the link https://near.social/webassemblymusic-treasury.near/widget/app via Telegram. + +image + From 502841f54e41c2baa9f44df1d85ac54f62db0d16 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sun, 9 Feb 2025 17:00:14 +0100 Subject: [PATCH 4/6] heading info --- docs/web4.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/web4.md b/docs/web4.md index df49f77..f60ff91 100644 --- a/docs/web4.md +++ b/docs/web4.md @@ -1,3 +1,10 @@ +--- +sidebar_position: 6 +sidebar_label: "Web4" +title: About the Web4 hosting +description: Upgrading the web4 contract and setting social link preview metadata +--- + # Web4 Instances created by the treasury factory, will get two accounts: @@ -7,7 +14,7 @@ Instances created by the treasury factory, will get two accounts: The first account will have the sputnik-dao contract deployed, and the second will get a web4 contract. [Web4](https://github.com/vgrichina/web4) contracts acts as a web server, so that you can get a dedicated page for your treasury in addition to gateways like https://near.social or https://dev.near.org. You can find the web4 page for your treasury at https://.near.page. -## Updating the web4 contract +## Upgrading the web4 contract The [web4 contract for the treasury app](https://github.com/NEAR-DevHub/neardevhub-treasury-dashboard/tree/staging/web4/treasury-web4), is under constant development, and there may be newer versions available since your treasury instance was created. @@ -29,7 +36,7 @@ near contract deploy .near use-file treasury-web4.wasm without-init-call n Follow the instructions to sign the transaction using your preferred way of signing. You may access the web4 account with the same key that you used to create the treasury. -## Setting metadata +## Setting social link preview metadata A feature of web4 is to provide metadata for social link previews. The treasury factory will set some defaults when creating the treasury, but you may set your own metadata by calling the `set_social_metadata` function of the web4 contract. From eb344a5beee2d9ee75bb56c08117b16ccb316dc0 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sun, 9 Feb 2025 17:08:15 +0100 Subject: [PATCH 5/6] replace with your-treasury-name --- docs/web4.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/web4.md b/docs/web4.md index f60ff91..8a73901 100644 --- a/docs/web4.md +++ b/docs/web4.md @@ -9,10 +9,10 @@ description: Upgrading the web4 contract and setting social link preview metadat Instances created by the treasury factory, will get two accounts: -- `.sputnik-dao.near` -- `.near` +- `your-treasury-name.sputnik-dao.near` +- `your-treasury-name.near` -The first account will have the sputnik-dao contract deployed, and the second will get a web4 contract. [Web4](https://github.com/vgrichina/web4) contracts acts as a web server, so that you can get a dedicated page for your treasury in addition to gateways like https://near.social or https://dev.near.org. You can find the web4 page for your treasury at https://.near.page. +The first account will have the sputnik-dao contract deployed, and the second will get a web4 contract. [Web4](https://github.com/vgrichina/web4) contracts acts as a web server, so that you can get a dedicated page for your treasury in addition to gateways like https://near.social or https://dev.near.org. You can find the web4 page for your treasury at https://your-treasury-name.near.page. ## Upgrading the web4 contract @@ -28,10 +28,10 @@ Once installed you can type the following in a terminal to download the `treasur near contract download-wasm treasury-testing.near save-to-file treasury-web4.wasm network-config mainnet now ``` -The next step is to deploy the contract to your treasury account. You can do this by typing the following (remember to replace `` with your own treasury account name): +The next step is to deploy the contract to your treasury account. You can do this by typing the following (remember to replace `your-treasury-name` with your own treasury account name): ```bash -near contract deploy .near use-file treasury-web4.wasm without-init-call network-config mainnet +near contract deploy your-treasury-name.near use-file treasury-web4.wasm without-init-call network-config mainnet ``` Follow the instructions to sign the transaction using your preferred way of signing. You may access the web4 account with the same key that you used to create the treasury. From e230615c1bbbad80adc2da7579df82d9ee652d27 Mon Sep 17 00:00:00 2001 From: Peter Salomonsen Date: Sun, 9 Feb 2025 17:18:14 +0100 Subject: [PATCH 6/6] about set_metadata params and IPFS --- docs/web4.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/web4.md b/docs/web4.md index 8a73901..1e4fb53 100644 --- a/docs/web4.md +++ b/docs/web4.md @@ -38,7 +38,9 @@ Follow the instructions to sign the transaction using your preferred way of sign ## Setting social link preview metadata -A feature of web4 is to provide metadata for social link previews. The treasury factory will set some defaults when creating the treasury, but you may set your own metadata by calling the `set_social_metadata` function of the web4 contract. +A feature of the treasury web4 contract is to provide metadata for social link previews. The treasury factory will set some defaults when creating the treasury, but you may set your own metadata by calling the `set_social_metadata` function of the web4 contract. + +The `set_social_metadata` function accepts JSON arguments with the fields `name`, `description` and `ipfs_cid`. *IPFS CID* is a content identifier for [IPFS](https://en.wikipedia.org/wiki/InterPlanetary_File_System), and near.social hosts an IPFS gateway so that you can reach files uploaded to IPFS via the browser. The image file uploaded with the CID `bafybeihsid3qgrb2dd4adsd4kuwe3pondtjr3u27ru6e2mbvabvm4rocru` can be reached at the URL https://ipfs.near.social/ipfs/bafybeihsid3qgrb2dd4adsd4kuwe3pondtjr3u27ru6e2mbvabvm4rocru. Here is an example that was used to set metadata for the treasury created at https://webassemblymusic-treasury.near.page ( remember to replace `webassemblymusic-treasury.near` with your treasury web4 account name.