From fdb0e426978eca96d4b7276f3a73bbca2ad180ae Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Thu, 19 Sep 2024 14:57:18 +0300 Subject: [PATCH 1/7] Change ledger guardian signing to cross window --- .../sdk-dapp/internal-processes/guardians.md | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md index 4171f4c4c..799602600 100644 --- a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md +++ b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md @@ -44,16 +44,27 @@ All signing providers (except Ledger) take care internally of formatting the tra After formatting the transaction and applying the signature provided by the Ledger device, the transaction must be signed by the Guardian. This is done by sending the transaction (or transactions array) to the web wallet 2FA hook. The web wallet will then prompt the user to sign the transaction with the Guardian account, and respond with the signed transaction. ```js -import { WalletProvider } from '@multiversx/sdk-web-wallet-provider'; - -const walletProvider = new WalletProvider('https://wallet.multiversx.com/dapp/init'); -walletProvider.guardTransactions(transactions, { - callbackUrl: encodeURIComponent('https://my-dapp.com'), -}); +import { CrossWindowProvider } from "@multiversx/sdk-web-wallet-cross-window-provider"; + +// instantiate wallet cross-window provider +await CrossWindowProvider.getInstance().init(); +const crossWindowProvider = CrossWindowProvider.getInstance(); +crossWindowProvider.setWalletUrl(WALLET_PROVIDER_URL); + +// set sender +const ledgerSenderBech32 = await this.hwProvider.getAddress(); +const ledgerSender = new Address(senderBech32); +const sender = ledgerSender; // or "erd1...abc" witohut awaiting `getAddress()` +crossWindowProvider.setAddress(sender); + +// the user signs transactions on ledger so we need to perform an extra +// user action with a confirmation popup so the browser opens the new tab +crossWindowProvider.setShouldShowConsentPopup(true); + +const guardedTransactions = await crossWindowProvider.guardTransactions( + signedTransactions +); ``` -Once transactions are back from the web wallet, they can be retrieved as follows: -```js -const signedTransactions = new WalletProvider('https://wallet.multiversx.com/dapp/init').getTransactionsFromWalletUrl(); -``` +For a working example see the code used in [signing-providers](https://github.com/multiversx/mx-sdk-js-examples/blob/594465208fd3a9d5c57bca8ecc94f2dc59cbf4a6/signing-providers/src/hw.js#L87) From 428e496e92366617f7f7647ff1d39d8dfd3a2457 Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Wed, 25 Sep 2024 17:18:58 +0300 Subject: [PATCH 2/7] Resolve comments --- .../sdk-dapp/internal-processes/guardians.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md index 799602600..d2f05ff22 100644 --- a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md +++ b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md @@ -53,18 +53,13 @@ crossWindowProvider.setWalletUrl(WALLET_PROVIDER_URL); // set sender const ledgerSenderBech32 = await this.hwProvider.getAddress(); -const ledgerSender = new Address(senderBech32); -const sender = ledgerSender; // or "erd1...abc" witohut awaiting `getAddress()` +const sender = Address.newFromBech32(ledgerSenderBech32); // or "erd1...abc" witohut awaiting `getAddress()` crossWindowProvider.setAddress(sender); -// the user signs transactions on ledger so we need to perform an extra -// user action with a confirmation popup so the browser opens the new tab +// To complete the transaction, the user will sign using their Ledger device. This requires an additional step: a confirmation popup will appear, prompting the user to approve the action, after which a new tab will open in the browser. crossWindowProvider.setShouldShowConsentPopup(true); const guardedTransactions = await crossWindowProvider.guardTransactions( signedTransactions ); -``` - -For a working example see the code used in [signing-providers](https://github.com/multiversx/mx-sdk-js-examples/blob/594465208fd3a9d5c57bca8ecc94f2dc59cbf4a6/signing-providers/src/hw.js#L87) - +``` \ No newline at end of file From 764cd4b38c8fde1b3d80cceef1372bae4fa14bfc Mon Sep 17 00:00:00 2001 From: Tudor Morar Date: Wed, 25 Sep 2024 17:35:06 +0300 Subject: [PATCH 3/7] Bring back comment --- docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md index d2f05ff22..70140dde7 100644 --- a/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md +++ b/docs/sdk-and-tools/sdk-dapp/internal-processes/guardians.md @@ -62,4 +62,7 @@ crossWindowProvider.setShouldShowConsentPopup(true); const guardedTransactions = await crossWindowProvider.guardTransactions( signedTransactions ); -``` \ No newline at end of file +``` + +For a working example see the code used in [signing-providers](https://github.com/multiversx/mx-sdk-js-examples/releases/tag/v0.9.0) + From 9c7b641a3e3f93e2d332a24adfcc49eda0235af2 Mon Sep 17 00:00:00 2001 From: 413x5 <159362274+413x5@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:03:56 +0100 Subject: [PATCH 4/7] Update sc-payments.md Broken link --- docs/developers/developer-reference/sc-payments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers/developer-reference/sc-payments.md b/docs/developers/developer-reference/sc-payments.md index 879c605e9..23f73ecb4 100644 --- a/docs/developers/developer-reference/sc-payments.md +++ b/docs/developers/developer-reference/sc-payments.md @@ -87,4 +87,4 @@ Additional restrictions on the incoming tokens can be imposed in the body of the ## Sending payments -We have seen how contracts can accommodate receiving tokens. Sending them is, in principle, even more straightforward, as it only involves specializing the `Payment` generic of the transaction using specific methods, or better said, attaching a payload to a regular transaction. Read more about payments [here](../../developers/transactions/tx-payment). \ No newline at end of file +We have seen how contracts can accommodate receiving tokens. Sending them is, in principle, even more straightforward, as it only involves specializing the `Payment` generic of the transaction using specific methods, or better said, attaching a payload to a regular transaction. Read more about payments [here](../transactions/tx-payment.md). From 4deddbb6568ed0ef5e8a02a21cc4df0e468de61b Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Fri, 13 Dec 2024 14:05:12 +0200 Subject: [PATCH 5/7] proxy no-status-check --- docs/sdk-and-tools/proxy.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sdk-and-tools/proxy.md b/docs/sdk-and-tools/proxy.md index 4284a87e0..ae2cd3cc4 100644 --- a/docs/sdk-and-tools/proxy.md +++ b/docs/sdk-and-tools/proxy.md @@ -76,6 +76,10 @@ The Proxy holds its configuration within the `config` folder: - `apiConfig/credentials.toml` - this file holds the configuration needed for enabling secured endpoints - only accessible by using BasicAuth. - `apiConfig/v1_0.toml` - this file contains all the endpoints with their settings (open, secured and rate limit). +:::note +If the provided observers' addresses from `config.toml` are not physical addresses of each observer, but rather addresses of providers that manage multiple observers for each shard, with self handling of health checks, the Proxy must be started with `--no-status-check` flag. +::: + [comment]: # (mx-context-auto) ## **Snapshotless observers support** From 8529a56288df1f4d6e3a658cdfbdead45fd1cc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Thu, 10 Jul 2025 17:14:39 +0300 Subject: [PATCH 6/7] Adjust subtitle (JS cookbook). --- docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md b/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md index 875b9929b..76f507f53 100644 --- a/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md +++ b/docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v14.md @@ -1240,7 +1240,7 @@ First, we load the abi file, then we fetch the transaction, we extract the event } ``` -#### Decoding transaction events +#### Encoding / decoding custom types Whenever needed, the contract ABI can be used for manually encoding or decoding custom types. Let's encode a struct called EsdtTokenPayment (of [multisig](https://github.com/multiversx/mx-contracts-rs/tree/main/contracts/multisig) contract) into binary data. From dfd8567efa73f2c5a117c7baf034f51c7c96cd89 Mon Sep 17 00:00:00 2001 From: axenteoctavian Date: Fri, 11 Jul 2025 11:32:38 +0300 Subject: [PATCH 7/7] Sovereign docs update --- docs/sovereign/distributed-setup.md | 6 ++-- docs/sovereign/local-setup.md | 11 +++++++ docs/sovereign/sovereign-api.md | 47 ++++++++++++++++++++++++++++ docs/sovereign/sovereign-explorer.md | 18 +++++++++++ docs/sovereign/sovereign-wallet.md | 4 +-- 5 files changed, 81 insertions(+), 5 deletions(-) diff --git a/docs/sovereign/distributed-setup.md b/docs/sovereign/distributed-setup.md index d60bf3868..86d856e0f 100644 --- a/docs/sovereign/distributed-setup.md +++ b/docs/sovereign/distributed-setup.md @@ -13,9 +13,9 @@ Before proceeding, ensure that a **SSH key** for GitHub is configured on your ma git clone git@github.com:multiversx/mx-chain-sovereign-go.git ``` -2. Navigate to testnet directory: +2. Navigate to project directory: ```bash - cd mx-chain-sovereign-go/scripts/testnet + cd mx-chain-sovereign-go ``` ### Step 2: Seeder Build @@ -206,7 +206,7 @@ Adjust the flags as needed. You can find all the available flags in `/mx-chain-s #### # observer ``` -./sovereignnode --profile-mode --log-save --log-level *:INFO --log-logger-name --log-correlation --use-health-service --rest-api-interface :8080 --working-directory ~/my_observer_node +./sovereignnode --profile-mode --log-save --log-level *:INFO --log-logger-name --log-correlation --use-health-service --destination-shard-as-observer 0 --rest-api-interface :8080 --operation-mode db-lookup-extension --working-directory ~/my_observer_node ``` ### Staking transaction diff --git a/docs/sovereign/local-setup.md b/docs/sovereign/local-setup.md index 25304d3e4..f5e8a3bdc 100644 --- a/docs/sovereign/local-setup.md +++ b/docs/sovereign/local-setup.md @@ -34,6 +34,17 @@ Before proceeding, ensure that a **SSH key** for GitHub is configured on your ma ### Step 2: Deploy Sovereign setup +#### Sovereign chain with no main chain connection + +1. Update chain parameters in `variables.sh` file + +2. Start the chain with local scripts: +```bash +./config.sh && ./sovereignStart.sh +``` + +#### Sovereign chain with main chain connection + Navigate to the `sovereignBridge` folder: ```bash cd sovereignBridge diff --git a/docs/sovereign/sovereign-api.md b/docs/sovereign/sovereign-api.md index 684305937..c789160ca 100644 --- a/docs/sovereign/sovereign-api.md +++ b/docs/sovereign/sovereign-api.md @@ -1,5 +1,50 @@ # API service +## Deploy Sovereign Proxy service + +:::info +Proxy service is automatically deployed if the sovereign chain was started with [local setup](/sovereign/local-setup) +::: + +### Step 1: Get the `mx-chain-proxy-sovereign-go` Repository + +Before proceeding, ensure that a **SSH key** for GitHub is configured on your machine. + +1. Clone the GitHub repository: + ```bash + git clone git@github.com:multiversx/mx-chain-proxy-sovereign-go.git + ``` + +2. Navigate to proxy directory: + ```bash + cd mx-chain-proxy-sovereign-go/cmd/proxy + ``` + +### Step 2: Edit Proxy `config.toml` file + +Example: +``` +[[Observers]] + ShardId = 0 + Address = "http://127.0.0.1:10000" + +[[Observers]] + ShardId = 4294967295 + Address = "http://127.0.0.1:10000" +``` + +:::note +For sovereign proxy there are 2 Observers required for `ShardId` 0 and 4294967295. The `Address` should be the same for both. +::: + +### Step 3: Start Sovereign Proxy service + +Build and run the proxy +```bash +go build +./proxy --sovereign +``` + ## Deploy Sovereign API service ### Step 1: Get the `mx-api-service` Repository @@ -28,6 +73,8 @@ ### Step 3: Start Sovereign API service ```bash +npm install +npm run init npm run start:testnet ``` diff --git a/docs/sovereign/sovereign-explorer.md b/docs/sovereign/sovereign-explorer.md index 6f4111f55..4d0909162 100644 --- a/docs/sovereign/sovereign-explorer.md +++ b/docs/sovereign/sovereign-explorer.md @@ -17,6 +17,24 @@ git clone https://github.com/multiversx/mx-explorer-dapp.git 2. Update the parameters and URLs with your own configuration in `config.testnet.ts` file +Example configuration: +``` +{ + default: true, + id: 'sovereign', + name: 'Sovereign', + chainId: 'S', + adapter: 'api', + theme: 'default', + egldLabel: 'SOV', + walletAddress: 'https://localhost:3000', + explorerAddress: 'https://localhost:3003', + apiAddress: 'https://localhost:3002', + hrp: 'erd', + isSovereign: true +} +``` + ### Step 3: Start Sovereign Explorer ```bash diff --git a/docs/sovereign/sovereign-wallet.md b/docs/sovereign/sovereign-wallet.md index 13aa3c1dd..5ddcba205 100644 --- a/docs/sovereign/sovereign-wallet.md +++ b/docs/sovereign/sovereign-wallet.md @@ -15,7 +15,7 @@ git clone https://github.com/multiversx/mx-lite-wallet-dapp.git cd src/config ``` -2. Update the `config.sovereign.ts` file: +2. Update the `sharedNetworks.ts` file: - for `sovereign` item - update the URLs with your own - update `sovereignContractAddress` with contract address from `sovereignConfig.toml` -> `SubscribedEvents` from `OutgoingSubscribedEvents` @@ -26,7 +26,7 @@ git clone https://github.com/multiversx/mx-lite-wallet-dapp.git ```bash yarn install -yarn start:sovereign +yarn start-sovereign ``` Read more about deploying lite wallet in [GitHub](https://github.com/multiversx/mx-lite-wallet-dapp/tree/main#multiversx-lite-wallet-dapp).