-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed a broken link in the Japanese docs
- Loading branch information
1 parent
e637346
commit f0681ff
Showing
16 changed files
with
380 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
docs/tutorials/php/ecourty_xrpl-php/build-apps/create-a-wallet.md
This file contains 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,27 @@ | ||
# Create a wallet | ||
|
||
Creating an XRP Wallet is the base operation when building applications that interact with the XRP Ledger. | ||
|
||
If you want to import a wallet from an existing seed, refer to the [Import a Wallet](./import-a-wallet.md) tutorial. | ||
|
||
Wallets can be generated using two different algorithms: | ||
- ED25519 | ||
- SECP256K1 | ||
|
||
The XRPL-PHP library supports both algorithms. By default, the `ED25519` algorithm is used. | ||
|
||
_If you're interested in discovering how the generation workflows work, refer to the [ED25519 Key Derivation](/docs/concepts/accounts/cryptographic-keys.md#ed25519-key-derivation) or [SECP256K1 Key Dreivation](/docs/concepts/accounts/cryptographic-keys.md#secp256k1-key-derivation) documentation page_. | ||
|
||
<br /> | ||
|
||
```php | ||
<?php | ||
|
||
use XRPL\Enum\Algorithm; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$ed25519Wallet = Wallet::generate(Algorithm::ED25519); | ||
$secp256k1Wallet = Wallet::generate(Algorithm::SECP256K1); | ||
|
||
// Using Wallet::generate(); will use the ED25519 algorithm by default. | ||
``` |
35 changes: 35 additions & 0 deletions
35
docs/tutorials/php/ecourty_xrpl-php/build-apps/fund-a-test-wallet.md
This file contains 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,35 @@ | ||
--- | ||
seo: | ||
description: Fund a test wallet on the XRP Ledger using the ecourty/xrpl-php library. | ||
--- | ||
|
||
# Fund a test wallet | ||
|
||
Funding a test wallet is a simple process. | ||
You can use the XRPL PHP library to generate a new wallet and request funds from the XRP Testnet Faucet. | ||
|
||
```php | ||
<?php | ||
|
||
use XRPL\Enum\Network; | ||
use XRPL\Service\Faucet; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$wallet = Wallet::generate(); // Or Wallet::generateFromSeed('...'); | ||
Faucet::addFunds($wallet); // Will add 100 XRP to the Account associated to this wallet | ||
|
||
// By default, the Faucet class will fund the wallet on the testnet. | ||
// If you want to fund the wallet on the devnet, you can pass a second argument to the ::addFunds method: | ||
Faucet::addFunds($wallet, Network::DEVNET); | ||
|
||
// The Wallet::fundWallet facade method can also be used | ||
$wallet = Wallet::generate(); | ||
$wallet->addFunds(); | ||
``` | ||
|
||
{% admonition type="warning" name="Rate limiting" %} | ||
Sending too many requests will trigger the Faucet's rate limit. | ||
Re-import an already funded wallet instead of creating a new random one every time you run your test scripts. | ||
{% /admonition %} | ||
|
||
The funded wallets can then be used to submit transactions to the XRP Ledger. |
24 changes: 24 additions & 0 deletions
24
docs/tutorials/php/ecourty_xrpl-php/build-apps/import-a-wallet.md
This file contains 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,24 @@ | ||
# Import a wallet | ||
|
||
Importing an existing wallet is a common operation when building applications that interact with the XRP Ledger. | ||
|
||
All you need is your wallet seed. It should look like this: | ||
- **ED25519**: `sEdSgVhT1uGZErffGfLHX61ZkjAtPg2` (31 long) | ||
- **SECP256K1**: `ssPjp8iEJug1fFzksyMTQcJKe944V` (29 long) | ||
|
||
Then, simply import your wallet using either the `Wallet::generateFromSeed` facade method, or the `WalletGenerator::generateFromSeed` method. | ||
|
||
```php | ||
<?php | ||
|
||
use XRPL\Service\Wallet\WalletGenerator; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$seed = 'sEdSgVhT1uGZErffGfLHX61ZkjAtPg2'; | ||
|
||
// 1. Using the Wallet class | ||
$importedWallet = Wallet::generateFromSeed($seed); | ||
|
||
// 2. Using the WalletGenerator class | ||
$importedWallet = WalletGenerator::generateFromSeed($seed); | ||
``` |
33 changes: 33 additions & 0 deletions
33
docs/tutorials/php/ecourty_xrpl-php/build-apps/submit-transactions/index.md
This file contains 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 @@ | ||
# Submit Transactions | ||
|
||
Submitting transactions to the XRP Ledger using the `ecourty/xrpl-php` library is a straightforward process. | ||
|
||
This tutorial will guide you through the steps to create, sign, and submit a transaction to the XRP Ledger. | ||
All you need is a `Wallet` instance, or your own Wallet class implementing `WalletInterface`. | ||
|
||
{% admonition type="info" name="Mandatory Transaction Fields" %} | ||
Every transaction need to contain a `TransactionType` field, which defines the type of transaction you want to submit. | ||
Refer to the [Transaction Types documentation](/docs/references/protocol/transactions/types/index.md) for more information. | ||
{% /admonition %} | ||
|
||
```php | ||
<?php | ||
|
||
use XRPL\Client\XRPLClient; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$wallet = Wallet::generateFromSeed('...'); // Replace '...' with your seed | ||
|
||
$transactionPayload = [ | ||
'TransactionType' => 'Payment', | ||
'Account' => $wallet->getAddress(), | ||
'Destination' => 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY', | ||
'Amount' => '1000000', | ||
]; | ||
|
||
$client = new XRPLClient('https://s.altnet.rippletest.net:51234'); | ||
|
||
$result = $client->submitSingleSignTransaction($transactionPayload, $wallet); | ||
``` | ||
|
||
Every field will then be converted into its own [Internal Format](/docs/references/protocol/binary-format.md#internal-format) before being submitted to the XRP Ledger Node. |
50 changes: 50 additions & 0 deletions
50
docs/tutorials/php/ecourty_xrpl-php/build-apps/submit-transactions/mint-an-nft.md
This file contains 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,50 @@ | ||
--- | ||
seo: | ||
description: Mint an NFT on the XRP Ledger using the ecourty/xrpl-php library. | ||
--- | ||
|
||
# Mint an NFT | ||
|
||
Minting an NFT on the XRP Ledger is an easy process. | ||
You need to craft your transaction payload with care to avoid any errors: | ||
- Define the flags according to the NFT type you want to mint. [Documentation reference](/docs/references/protocol/transactions/types/nftokenmint#nftokenmint-flags) | ||
- Define the "content" or your NFT in the `URI` field, this is usually an IPFS link to the NFT metadata. | ||
- Craft the transaction! | ||
|
||
_Here is the [list of all the available fields on the `NFTokenMint` transaction](/docs/references/protocol/transactions/types/nftokenmint.md)_ | ||
|
||
<br /> | ||
|
||
Here is a tutorial on how to mint a simple NFT on the testnet, using a random wallet. | ||
```php | ||
<?php | ||
|
||
use XRPL\Client\XRPLClient; | ||
use XRPL\Service\Faucet; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$wallet = Wallet::generate(); | ||
Faucet::addFunds($wallet); | ||
|
||
echo 'Wallet generated and funded!' . \PHP_EOL; | ||
|
||
$client = new XRPLClient('https://s.altnet.rippletest.net:51234'); | ||
|
||
$transactionData = [ | ||
'TransactionType' => 'NFTokenMint', | ||
'Account' => $wallet->getAddress(), | ||
'URI' => '11223344', // Can be virtually anything (Needs to be a hex-encoded) | ||
'Flags' => 8, // Makes the NFT transferable | ||
'TransferFee' => 1000, // Fee for transferring the NFT | ||
'NFTokenTaxon' => 0, // Allows for grouping of NFTs (e.g. by collection, use the same taxon for NFTs of the same collection) | ||
]; | ||
|
||
$transactionResult = $client->submitSingleSignTransaction($transactionData, $wallet); | ||
|
||
echo 'NFT minted!' . \PHP_EOL; | ||
``` | ||
|
||
Easy, right? | ||
You can then retrieve the transaction hash from the `$transactionResult` object to track the transaction on the XRP Ledger. | ||
|
||
More examples can be found in the [ecourty/xrpl-php GitHub repository](https://github.com/EdouardCourty/xrpl-php) |
36 changes: 36 additions & 0 deletions
36
...tutorials/php/ecourty_xrpl-php/build-apps/submit-transactions/send-a-payment.md
This file contains 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,36 @@ | ||
--- | ||
seo: | ||
description: Send a payment on the XRP Ledger using the ecourty/xrpl-php library. | ||
--- | ||
|
||
# Send a Payment | ||
|
||
Payment are the most executed transactions on the XRP Ledger! | ||
All you need is a funded Wallet and a destination address. | ||
|
||
<br /> | ||
|
||
```php | ||
<?php | ||
|
||
use XRPL\Client\XRPLClient; | ||
use XRPL\ValueObject\Wallet; | ||
|
||
$wallet = Wallet::generate(); | ||
Faucet::addFunds($wallet); | ||
|
||
$client = new XRPLClient('https://s.altnet.rippletest.net:51234'); // Public Testnet Ripple Node | ||
|
||
$transactionData = [ | ||
'TransactionType' => 'Payment', | ||
'Account' => $wallet->getAddress(), | ||
'Destination' => $receiverWallet->getAddress(), | ||
'Amount' => XRPConverter::xrpToDrops(25), // 25 XRP | ||
]; | ||
|
||
$client->submitSingleSignTransaction($transactionData, $originWallet); | ||
``` | ||
|
||
You can then retrieve the transaction hash from the `$transactionResult` object to track the transaction on the XRP Ledger. | ||
|
||
More examples can be found in the [ecourty/xrpl-php GitHub repository](https://github.com/EdouardCourty/xrpl-php) |
Oops, something went wrong.