-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move Single Asset Vault docs from opensource #3261
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
Open
maria-robobug
wants to merge
6
commits into
rippled-3.0.0
Choose a base branch
from
sav-concept-and-reference-docs
base: rippled-3.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,493
−152
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d8b216b
Fix for build failure
maria-robobug d6b55ab
Merge pull request #3375 from XRPLF/build-fix
maria-robobug 9e96d40
Add Get Started Walkthrough for Python
maria-robobug eb174b8
Add review comments
maria-robobug 01ed305
Merge pull request #3299 from XRPLF/python-get-started-code-walkthrough
maria-robobug 98b334c
Move Single Asset Vault docs from opensource
maria-robobug File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Get Started Using Python Library | ||
|
|
||
| Connects to the XRP Ledger and gets account information using Python. | ||
|
|
||
| To download the source code, see [Get Started Using Python Library](http://xrpl.org/docs/tutorials/python/build-apps/get-started). | ||
|
|
||
| ## Run the Code | ||
|
|
||
| Quick setup and usage: | ||
|
|
||
| ```sh | ||
| python -m venv .venv | ||
| source .venv/bin/activate | ||
| pip install -r requirements.txt | ||
| python ./get-acct-info.py | ||
| ``` | ||
|
|
||
| You should see output similar to the following: | ||
|
|
||
| ```sh | ||
| Creating a new wallet and funding it with Testnet XRP... | ||
| Attempting to fund address ravbHNootpSNQkxyEFCWevSkHsFGDHfyop | ||
| Faucet fund successful. | ||
| Wallet: ravbHNootpSNQkxyEFCWevSkHsFGDHfyop | ||
| Account Testnet Explorer URL: | ||
| https://testnet.xrpl.org/accounts/ravbHNootpSNQkxyEFCWevSkHsFGDHfyop | ||
|
|
||
| Getting account info... | ||
| Response Status: ResponseStatus.SUCCESS | ||
| { | ||
| "account_data": { | ||
| "Account": "ravbHNootpSNQkxyEFCWevSkHsFGDHfyop", | ||
| "Balance": "100000000", | ||
| "Flags": 0, | ||
| "LedgerEntryType": "AccountRoot", | ||
| "OwnerCount": 0, | ||
| "PreviousTxnID": "3DACF2438AD39F294C4EFF6132D5D88BCB65D2F2261C7650F40AC1F6A54C83EA", | ||
| "PreviousTxnLgrSeq": 12039759, | ||
| "Sequence": 12039759, | ||
| "index": "148E6F4B8E4C14018D679A2526200C292BDBC5AB77611BC3AE0CB97CD2FB84E5" | ||
| }, | ||
| "account_flags": { | ||
| "allowTrustLineClawback": false, | ||
| "defaultRipple": false, | ||
| "depositAuth": false, | ||
| "disableMasterKey": false, | ||
| "disallowIncomingCheck": false, | ||
| "disallowIncomingNFTokenOffer": false, | ||
| "disallowIncomingPayChan": false, | ||
| "disallowIncomingTrustline": false, | ||
| "disallowIncomingXRP": false, | ||
| "globalFreeze": false, | ||
| "noFreeze": false, | ||
| "passwordSpent": false, | ||
| "requireAuthorization": false, | ||
| "requireDestinationTag": false | ||
| }, | ||
| "ledger_hash": "CA624D717C4FCDD03BAD8C193F374A77A14F7D2566354A4E9617A8DAD896DE71", | ||
| "ledger_index": 12039759, | ||
| "validated": true | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,39 @@ | ||
| # @chunk {"steps": ["connect-tag"]} | ||
| # Define the network client | ||
| from xrpl.clients import JsonRpcClient | ||
| from xrpl.wallet import generate_faucet_wallet | ||
| from xrpl.core import addresscodec | ||
| from xrpl.models.requests.account_info import AccountInfo | ||
| import json | ||
|
|
||
| JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/" | ||
| client = JsonRpcClient(JSON_RPC_URL) | ||
| # @chunk-end | ||
|
|
||
|
|
||
| # Create a wallet using the testnet faucet: | ||
| # @chunk {"steps": ["get-account-create-wallet-tag"]} | ||
| # Create a wallet using the Testnet faucet: | ||
| # https://xrpl.org/xrp-testnet-faucet.html | ||
| from xrpl.wallet import generate_faucet_wallet | ||
| print("\nCreating a new wallet and funding it with Testnet XRP...") | ||
| test_wallet = generate_faucet_wallet(client, debug=True) | ||
|
|
||
| # Create an account str from the wallet | ||
| test_account = test_wallet.address | ||
|
|
||
| # Derive an x-address from the classic address: | ||
| # https://xrpaddress.info/ | ||
| from xrpl.core import addresscodec | ||
| test_xaddress = addresscodec.classic_address_to_xaddress(test_account, tag=12345, is_test_network=True) | ||
| print("\nClassic address:\n\n", test_account) | ||
| print("X-address:\n\n", test_xaddress) | ||
| test_account = test_wallet.classic_address | ||
| print(f"Wallet: {test_account}") | ||
| print(f"Account Testnet Explorer URL: ") | ||
| print(f" https://testnet.xrpl.org/accounts/{test_account}") | ||
| # @chunk-end | ||
|
|
||
|
|
||
| # @chunk {"steps": ["query-xrpl-tag"]} | ||
| # Look up info about your account | ||
| from xrpl.models.requests.account_info import AccountInfo | ||
| print("\nGetting account info...") | ||
| acct_info = AccountInfo( | ||
| account=test_account, | ||
| ledger_index="validated", | ||
| strict=True, | ||
| ) | ||
|
|
||
| response = client.request(acct_info) | ||
| result = response.result | ||
| print("response.status: ", response.status) | ||
| import json | ||
| print("Response Status: ", response.status) | ||
| print(json.dumps(response.result, indent=4, sort_keys=True)) | ||
| # @chunk-end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| xrpl-py==4.3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| seo: | ||
| description: A pseudo-account is a special type of XRPL account that holds assets on behalf of an on-chain protocol. | ||
| labels: | ||
| - Single Asset Vault | ||
| - AMM | ||
| - Lending Protocol | ||
| status: not_enabled | ||
| --- | ||
|
|
||
| # Pseudo-Accounts | ||
|
|
||
| The XRP Ledger is an account-based blockchain where assets like XRP, trust line tokens, and Multi-Purpose Tokens (MPTs) are held by accounts, and are represented on-chain by an [AccountRoot](../../references/protocol/ledger-data/ledger-entry-types/accountroot) ledger entry. However, certain use cases require assets to be transferable to and from an object, which is why a pseudo-account is needed. | ||
|
|
||
| A pseudo-account is a special type of account that holds assets on behalf of an on-chain protocol. Use cases for pseudo-accounts include: | ||
|
|
||
| - **Automated Market Makers (AMM)**: The [XLS-30 amendment](../../../resources/known-amendments#amm) introduced pseudo-accounts for AMMs by adding the `AMMID` field to the `AccountRoot` ledger entry. This field links a pseudo-account to an AMM instance, allowing it to track XRP and token balances in the pool and issue `LPTokens` on behalf of the AMM instance. | ||
|
|
||
| - **Single Asset Vaults**: A single asset vault pseudo-account is used to store deposited funds and issue MPT shares. A new `VaultID` field is introduced in the `AccountRoot` ledger entry, which links the pseudo-account with the vault. | ||
|
|
||
| - **Lending Protocol**: The Lending Protocol uses pseudo-accounts for the `LoanBroker`, linked via a `LoanBrokerID` field in the `AccountRoot`. These pseudo-accounts hold first-loss capital that protects vault depositors from loan defaults. | ||
|
|
||
| A pseudo-account has strict limitations. It cannot receive payments from other accounts, cannot send transactions since it has no signing authority, and exists solely to store or issue assets. | ||
|
|
||
| ## Reserve Requirements | ||
|
|
||
| The cost of creating a pseudo-account depends on whether it is owned and controlled by another account: | ||
|
|
||
| - **Owned pseudo-accounts**: For objects like a `Vault` where a single account owns and controls the associated pseudo-account, the creation transaction increases the owner's XRP reserve by one [incremental owner reserve](../accounts/reserves#base-reserve-and-owner-reserve) (currently {% $env.PUBLIC_OWNER_RESERVE %}). This is in addition to any other reserve requirements of the transaction (for example, the Vault object itself). The transaction fee is the standard network fee. | ||
|
|
||
| - **Unowned pseudo-accounts**: For objects like an `AMM` that are not owned by any account, the creation transaction must charge a special, higher-than-normal transaction fee. This fee must be at least the value of one incremental owner reserve. This amount is burned, compensating for the permanent ledger space without tying the reserve to a specific owner. | ||
|
|
||
| {% raw-partial file="/docs/_snippets/common-links.md" /%} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.