From cf215502c1aa646c3864d78ce015ea2e8fc8cf1a Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Fri, 10 May 2024 14:12:03 -0700 Subject: [PATCH 1/3] Add schema for new stateChanges array in simulateTransaction (also yarn fmt:mdx?) --- docs/smart-contracts/guides/dapps/docker.mdx | 2 +- openrpc/src/methods/simulateTransaction.json | 26 ++++++++++ .../challenges/challenge-0-crowdfund.mdx | 4 +- .../dapps/challenges/challenge-1-payment.mdx | 4 +- .../challenges/challenge-2-liquidity-pool.mdx | 6 +-- .../dapps/challenges/challenge-3-oracle.mdx | 2 +- static/openrpc.json | 50 ++++++++++++++++++- 7 files changed, 84 insertions(+), 10 deletions(-) diff --git a/docs/smart-contracts/guides/dapps/docker.mdx b/docs/smart-contracts/guides/dapps/docker.mdx index e2bd465ed..ad789e98b 100644 --- a/docs/smart-contracts/guides/dapps/docker.mdx +++ b/docs/smart-contracts/guides/dapps/docker.mdx @@ -132,5 +132,5 @@ The `quickstart.sh` script sets up the Docker environment for running the dapp. - Runs the `soroban-preview` container, which provides the Soroban Preview environment for development. - Runs the `stellar/quickstart` Docker image, which sets up the Stellar network using the chosen network type and enables Soroban RPC. -[`stellar/quickstart` Docker image]: https://hub.docker.com/r/stellar/quickstart +[`stellar/quickstart` docker image]: https://hub.docker.com/r/stellar/quickstart [example crowdfund dapp]: https://github.com/stellar/soroban-example-dapp diff --git a/openrpc/src/methods/simulateTransaction.json b/openrpc/src/methods/simulateTransaction.json index 0dea87a5f..19e38353d 100644 --- a/openrpc/src/methods/simulateTransaction.json +++ b/openrpc/src/methods/simulateTransaction.json @@ -91,6 +91,32 @@ }, "required": [ "minResourceFee", "transactionData" ] }, + "stateChanges": { + "type": "array", + "description": "(optional) - On successful simulation of `InvokeHostFunction` operations, this field will be an array of `LedgerEntry`s before and after simulation occurred. Note that _at least_ one of `before` or `after` will be present: `before` and no `after` indicates a deletion event, the inverse is a creation event, and both present indicates an update event. Or just check the `type`.", + "items": { + "type": "object", + "properties": { + "^type$": { + "oneOf": [1, 2, 3], + "description": "Indicates if the entry was created (1), updated (2), or deleted (3)" + }, + "key": { + "type": "string", + "description": "Base64 - the `LedgerEntryKey` for this delta" + }, + "before": { + "type": "string", + "description": "(optional) Base64 - `LedgerEntry` state prior to simulation" + }, + "after": { + "type": "string", + "description": "(optional) Base64 - `LedgerEntry` state after simulation" + } + }, + "required": [ "type", "key" ] + } + }, "error": { "type": "string", "description": "(optional) - This field will include details about why the invoke host function call failed. Only present if the transaction simulation failed." diff --git a/src/pages/docs/learn/interactive/dapps/challenges/challenge-0-crowdfund.mdx b/src/pages/docs/learn/interactive/dapps/challenges/challenge-0-crowdfund.mdx index 1e7539222..ed9ba49ce 100644 --- a/src/pages/docs/learn/interactive/dapps/challenges/challenge-0-crowdfund.mdx +++ b/src/pages/docs/learn/interactive/dapps/challenges/challenge-0-crowdfund.mdx @@ -215,7 +215,7 @@ If you don't have the Vercel cli installed, run the following command to install npm i --global vercel ``` -[Vercel account]: https://vercel.com/login +[vercel account]: https://vercel.com/login Next, you will need to remove the `target` directory to save space for the the deployment. Run the following command to remove the `target` directory: @@ -329,7 +329,7 @@ You should see something like this: ] ``` -[Stellar Laboratory]: https://laboratory.stellar.org/#explorer?network=futurenet +[stellar laboratory]: https://laboratory.stellar.org/#explorer?network=futurenet ## 📚 User Workflows Checklist diff --git a/src/pages/docs/learn/interactive/dapps/challenges/challenge-1-payment.mdx b/src/pages/docs/learn/interactive/dapps/challenges/challenge-1-payment.mdx index efe7faaca..6f6d5c1a3 100644 --- a/src/pages/docs/learn/interactive/dapps/challenges/challenge-1-payment.mdx +++ b/src/pages/docs/learn/interactive/dapps/challenges/challenge-1-payment.mdx @@ -294,7 +294,7 @@ In this step, you will deploy your dapp to a hosting platform so that it can be If you dont already have a [Vercel account], you will need to create one and link it to your GitHub account. -[Vercel account]: https://vercel.com/login +[vercel account]: https://vercel.com/login First install the Vercel cli: @@ -435,7 +435,7 @@ Don't forget to share your work with the community. Let others see what you've a Consider customizing the code and submitting a pull request for the challenge. You can explore advanced features of the Example Soroban Payment Dapp, and Freighter wallet to take your skills to the next level. Show your creativity by adding unique functionalities, enhancing the user interface, or integrating with other APIs or services. Good luck! -[Fork the Example Soroban Payment Dapp repo]: https://github.com/stellar/soroban-react-payment +[fork the example soroban payment dapp repo]: https://github.com/stellar/soroban-react-payment ## 📚 User Workflows Checklist diff --git a/src/pages/docs/learn/interactive/dapps/challenges/challenge-2-liquidity-pool.mdx b/src/pages/docs/learn/interactive/dapps/challenges/challenge-2-liquidity-pool.mdx index 15fbd6c69..f49a674cc 100644 --- a/src/pages/docs/learn/interactive/dapps/challenges/challenge-2-liquidity-pool.mdx +++ b/src/pages/docs/learn/interactive/dapps/challenges/challenge-2-liquidity-pool.mdx @@ -305,7 +305,7 @@ Once the transaction is confirmed, you should see updated balances on the fronte Now that your dapp is fully functional, its time to deploy it to a production environment. In this step, you will learn how to deploy your dapp to Vercel, a cloud platform for static sites that offers a quick and effective way to deploy the frontend of your dapp. This section requires that you have a [Vercel account] and install the Vercel CLI. -[Vercel account]: https://vercel.com/login +[vercel account]: https://vercel.com/login First, you will remove the target directory, as it is not used by Vercel to deploy your site. To do this, navigate to the `liquidity-pool` directory and run the following: @@ -433,8 +433,8 @@ Customize the code and submit a pull request for the Liquidity Pool Dapp Challen Take this opportunity to showcase your skills and make your mark on the Liquidity Pool Dapp. Good luck! -[Stellar Laboratory]: https://laboratory.stellar.org/#explorer?network=futurenet -[Fork the Soroban Dapps Challenge repo]: https://github.com/stellar/soroban-dapps-challenge/fork +[stellar laboratory]: https://laboratory.stellar.org/#explorer?network=futurenet +[fork the soroban dapps challenge repo]: https://github.com/stellar/soroban-dapps-challenge/fork ## 📚 User Workflows Checklist diff --git a/src/pages/docs/learn/interactive/dapps/challenges/challenge-3-oracle.mdx b/src/pages/docs/learn/interactive/dapps/challenges/challenge-3-oracle.mdx index 1fc6bb04f..51f864c6c 100644 --- a/src/pages/docs/learn/interactive/dapps/challenges/challenge-3-oracle.mdx +++ b/src/pages/docs/learn/interactive/dapps/challenges/challenge-3-oracle.mdx @@ -348,7 +348,7 @@ In this step, you will deploy your dapp to a hosting platform so that it can be If you don't already have a [Vercel account], you will need to create one and link it to your GitHub account. -[Vercel account]: https://vercel.com/login +[vercel account]: https://vercel.com/login First install the Vercel cli: diff --git a/static/openrpc.json b/static/openrpc.json index 7c18ac536..76c4cc076 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -351,6 +351,18 @@ "status": { "type": "string", "description": "\"healthy\"" + }, + "latestLedger": { + "type": "number", + "description": "Most recent known ledger sequence" + }, + "oldestLedger": { + "type": "number", + "description": "Oldest ledger sequence kept in history" + }, + "ledgerRetentionWindow": { + "type": "number", + "description": "Maximum retention window configured. A full window state can be determined via: ledgerRetentionWindow = latestLedger - oldestLedger + 1" } } } @@ -363,7 +375,10 @@ "result": { "name": "getHealthResult", "value": { - "status": "healthy" + "status": "healthy", + "latestLedger": 51583040, + "oldestLedger": 51565760, + "ledgerRetentionWindow": 17281 } } } @@ -1117,6 +1132,39 @@ } } }, + "stateChanges": { + "type": "array", + "description": "(optional) - On successful simulation of `InvokeHostFunction` operations, this field will be an array of `LedgerEntry`s before and after simulation occurred. Note that _at least_ one of `before` or `after` will be present: `before` and no `after` indicates a deletion event, the inverse is a creation event, and both present indicates an update event. Or just check the `type`.", + "items": { + "type": "object", + "required": [ + "type", + "key" + ], + "properties": { + "^type$": { + "oneOf": [ + {}, + {}, + {} + ], + "description": "Indicates if the entry was created (1), updated (2), or deleted (3)" + }, + "key": { + "type": "string", + "description": "Base64 - the `LedgerEntryKey` for this delta" + }, + "before": { + "type": "string", + "description": "(optional) Base64 - `LedgerEntry` state prior to simulation" + }, + "after": { + "type": "string", + "description": "(optional) Base64 - `LedgerEntry` state after simulation" + } + } + } + }, "error": { "type": "string", "description": "(optional) - This field will include details about why the invoke host function call failed. Only present if the transaction simulation failed." From 24987763beffe425408943023487ee0519f5c610 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Tue, 14 May 2024 13:10:46 -0700 Subject: [PATCH 2/3] Fix typo in xdr type name, type to be list of enums --- openrpc/src/methods/simulateTransaction.json | 7 ++++--- static/openrpc.json | 13 +++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/openrpc/src/methods/simulateTransaction.json b/openrpc/src/methods/simulateTransaction.json index 19e38353d..d4cabe535 100644 --- a/openrpc/src/methods/simulateTransaction.json +++ b/openrpc/src/methods/simulateTransaction.json @@ -97,13 +97,14 @@ "items": { "type": "object", "properties": { - "^type$": { - "oneOf": [1, 2, 3], + "type": { + "type": "number", + "enum": [1, 2, 3], "description": "Indicates if the entry was created (1), updated (2), or deleted (3)" }, "key": { "type": "string", - "description": "Base64 - the `LedgerEntryKey` for this delta" + "description": "Base64 - the `LedgerKey` for this delta" }, "before": { "type": "string", diff --git a/static/openrpc.json b/static/openrpc.json index 76c4cc076..129f1e262 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -1142,17 +1142,18 @@ "key" ], "properties": { - "^type$": { - "oneOf": [ - {}, - {}, - {} + "type": { + "type": "number", + "enum": [ + 1, + 2, + 3 ], "description": "Indicates if the entry was created (1), updated (2), or deleted (3)" }, "key": { "type": "string", - "description": "Base64 - the `LedgerEntryKey` for this delta" + "description": "Base64 - the `LedgerKey` for this delta" }, "before": { "type": "string", From 3a9750be22b34d6d8c50d87b476d66ca78165581 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Tue, 14 May 2024 13:29:23 -0700 Subject: [PATCH 3/3] Use more-specific type specification --- openrpc/src/methods/simulateTransaction.json | 2 +- static/openrpc.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openrpc/src/methods/simulateTransaction.json b/openrpc/src/methods/simulateTransaction.json index d4cabe535..fccf2a6fc 100644 --- a/openrpc/src/methods/simulateTransaction.json +++ b/openrpc/src/methods/simulateTransaction.json @@ -98,7 +98,7 @@ "type": "object", "properties": { "type": { - "type": "number", + "type": "integer", "enum": [1, 2, 3], "description": "Indicates if the entry was created (1), updated (2), or deleted (3)" }, diff --git a/static/openrpc.json b/static/openrpc.json index 129f1e262..c5d34066a 100644 --- a/static/openrpc.json +++ b/static/openrpc.json @@ -1143,7 +1143,7 @@ ], "properties": { "type": { - "type": "number", + "type": "integer", "enum": [ 1, 2,