mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-21 20:25:51 +00:00
Updates for 2.2.3
Add expiration date, fix indents.
This commit is contained in:
@@ -38,22 +38,14 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
|
|||||||
|
|
||||||
|
|
||||||
1. Open `4.transfer-nftokens.html` in a browser.
|
1. Open `4.transfer-nftokens.html` in a browser.
|
||||||
2. Get test accounts.
|
2. Choose **XLS20-NFT** as your ledger instance.
|
||||||
|
3. Get test accounts.
|
||||||
1. If you have existing NFT-Devnet account seeds
|
1. If you have existing NFT-Devnet account seeds
|
||||||
1. Paste account seeds in the **Seeds** field.
|
1. Paste account seeds in the **Seeds** field.
|
||||||
2. Click **Get Accounts from Seeds**.
|
2. Click **Get Accounts from Seeds**.
|
||||||
2. If you do not have NFT-Devnet account seeds:
|
2. If you do not have NFT-Devnet account seeds:
|
||||||
3. Visit the [XRP Testnet Faucet](https://xrpl.org/xrp-testnet-faucet.html) page.
|
1. Click **Get New Standby Account**.
|
||||||
4. Click **Generate NFT-Devnet credentials**.
|
2. Click **Get New Operational Account**.
|
||||||
5. Copy the account **Secret**.
|
|
||||||
6. Paste the secret in a persistent location, such as a notepad, and press return.
|
|
||||||
7. Click **Generate NFT-Devnet credentials** to create a second account.
|
|
||||||
8. Copy the account **Secret**.
|
|
||||||
9. Paste the secret in the persistent location.
|
|
||||||
10. Copy both secrets, separated by a return.
|
|
||||||
11. Paste them in the **Account** **Seeds** field.
|
|
||||||
12. Click **Get Accounts from Seeds**.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
@@ -65,13 +57,13 @@ You can download the [Quickstart Samples](https://github.com/XRPLF/xrpl-dev-port
|
|||||||
To create a NFToken sell offer:
|
To create a NFToken sell offer:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1. Enter the **Amount** of the sell offer in drops (millionths of an XRP).
|
1. Enter the **Amount** of the sell offer in drops (millionths of an XRP).
|
||||||
2. Set the **Flags** field to _1_.
|
2. Set the **Flags** field to _1_.
|
||||||
3. Enter the **Token ID** of the NFToken you want to sell.
|
3. Enter the **Token ID** of the NFToken you want to sell.
|
||||||
4. Click **Create Sell Offer**.
|
4. Optionally, enter a number of days until **Expiration**.
|
||||||
|
5. Click **Create Sell Offer**.
|
||||||
|
|
||||||
The important piece of information in the response is the Token Offer Index, labeled as _Index,_ which is used to accept the sell offer.
|
The important piece of information in the response is the Token Offer Index, labeled as _nft_offer_index,_ which is used to accept the sell offer.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -87,7 +79,7 @@ To accept an available sell offer:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1. Enter the **Token Offer Index** (labeled as _Index_ in the token offer results. This is not the same as the Token ID).
|
1. Enter the **Token Offer Index** (labeled as _nft_offer_index_ in the token offer results. This is not the same as the _nft_id_).
|
||||||
2. Click **Accept Sell Offer**.
|
2. Click **Accept Sell Offer**.
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +99,8 @@ To create an offer to buy a NFToken:
|
|||||||
1. Enter the **Amount** of your offer.
|
1. Enter the **Amount** of your offer.
|
||||||
2. Enter the **Token ID**.
|
2. Enter the **Token ID**.
|
||||||
3. Enter the owner’s account string in the **Owner** field.
|
3. Enter the owner’s account string in the **Owner** field.
|
||||||
4. Click **Create Buy Offer**.
|
4. Optionally enter the number of days until **Expiration**.
|
||||||
|
5. Click **Create Buy Offer**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -121,8 +114,7 @@ To accept an offer to buy a NFToken:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1. Enter the **Token Offer ID** (the **Index** of the token offer).
|
1. Enter the **Token Offer ID** (the _nft_offer_index_ of the token buy offer).
|
||||||
2. Enter the buyer’s account string in the **Owner** field (the buyer is the owner of the token offer).
|
|
||||||
3. Click **Accept Buy Offer**.
|
3. Click **Accept Buy Offer**.
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +125,9 @@ To accept an offer to buy a NFToken:
|
|||||||
|
|
||||||
## Get Offers
|
## Get Offers
|
||||||
|
|
||||||
Click **Get Offers** to get the buy and sell offers associated with a particular account.
|
To list the buy and sell offers associated with a NFToken:
|
||||||
|
1. Enter the **NFToken ID**.
|
||||||
|
2. Click **Get Offers**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -175,7 +169,7 @@ Connect to the ledger and get the wallet accounts.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
async function createSellOffer() {
|
async function createSellOffer() {
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
@@ -185,24 +179,49 @@ Connect to the ledger and get the wallet accounts.
|
|||||||
await client.connect()
|
await client.connect()
|
||||||
results += '\nConnected. Creating sell offer...'
|
results += '\nConnected. Creating sell offer...'
|
||||||
document.getElementById('standbyResultField').value = results
|
document.getElementById('standbyResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Compute the Expiration Date, if present. The expiration date represents the number of seconds after the Ripple Epoch that the offer should expire. Subtract the Ripple Epoch from the current system date divided by 1,000, and add the number of days (or fractions of a day) multiplied by 86400 to get the correct expiration date.
|
||||||
Define the transaction. The _Flags_ value of 1 indicates that this transaction is a sell offer.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
const transactionBlob = {
|
//------------------------------------- Prepare Expiration Date
|
||||||
|
var expirationDate = null
|
||||||
|
if (standbyExpirationField.value !="") {
|
||||||
|
var days = document.getElementById('standbyExpirationField').value
|
||||||
|
var secondsInDay = 86400
|
||||||
|
var rippleEpoch = 946684800
|
||||||
|
var currentTimestamp = (new Date() / 1000) - rippleEpoch
|
||||||
|
expirationDate = parseInt(Math.floor(currentTimestamp + (days*secondsInDay)))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Define the transaction. A _Flags_ value of 1 indicates that this transaction is a sell offer.
|
||||||
|
|
||||||
|
```
|
||||||
|
let transactionBlob = {
|
||||||
"TransactionType": "NFTokenCreateOffer",
|
"TransactionType": "NFTokenCreateOffer",
|
||||||
"Account": standby_wallet.classicAddress,
|
"Account": standby_wallet.classicAddress,
|
||||||
"TokenID": standbyTokenIdField.value,
|
"NFTokenID": standbyTokenIdField.value,
|
||||||
"Amount": standbyAmountField.value,
|
"Amount": standbyAmountField.value,
|
||||||
"Flags": parseInt(standbyFlagsField.value)
|
"Flags": parseInt(standbyFlagsField.value),
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If the Expiration Date is present, append it to the transaction.
|
||||||
|
|
||||||
|
```
|
||||||
|
if (expirationDate != null) {
|
||||||
|
transactionBlob.Expiration = expirationDate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
If the Destination field is not empty, append it to the transaction. When the destination is set, only the destination account can purchase the NFToken.
|
||||||
|
|
||||||
|
```
|
||||||
|
if(standbyDestinationField.value !== '') {
|
||||||
|
transactionBlob.Destination = standbyDestinationField.value
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -228,19 +247,15 @@ Request the list of sell offers for the token.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: standbyTokenIdField.value
|
nft_id: standbyTokenIdField.value})
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftSellOffers,null,2)
|
results += JSON.stringify(nftSellOffers,null,2)
|
||||||
results += '\n\n***Buy Offers***\n'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -248,17 +263,16 @@ Request the list of buy offers for the token.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
results += '\n\n***Buy Offers***\n'
|
||||||
let nftBuyOffers
|
let nftBuyOffers
|
||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: standbyTokenIdField.value })
|
nft_id: standbyTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
results += 'No buy offers.'
|
results += 'No buy offers.'
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -289,11 +303,8 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of createSellOffer()
|
}// End of createSellOffer()
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -307,7 +318,7 @@ Disconnect from the ledger.
|
|||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
|
||||||
async function createBuyOffer() {
|
async function createBuyOffer() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -324,10 +335,19 @@ Get the account wallets and connect to the ledger.
|
|||||||
await client.connect()
|
await client.connect()
|
||||||
results = '\nConnected. Creating buy offer...'
|
results = '\nConnected. Creating buy offer...'
|
||||||
document.getElementById('standbyResultField').value = results
|
document.getElementById('standbyResultField').value = results
|
||||||
|
```
|
||||||
|
Prepare the expiration date, if present.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
var expirationDate = null
|
||||||
|
if (standbyExpirationField.value !="") {
|
||||||
|
var days = document.getElementById('standbyExpirationField').value
|
||||||
|
var secondsInDay = 86400
|
||||||
|
var rippleEpoch = 946684800
|
||||||
|
var currentTimestamp = (new Date() / 1000) - rippleEpoch
|
||||||
|
expirationDate = parseInt(Math.floor(currentTimestamp + (days*secondsInDay)))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Define the transaction. Setting the _Flags_ value to _null_ indicates that this is a buy offer.
|
Define the transaction. Setting the _Flags_ value to _null_ indicates that this is a buy offer.
|
||||||
|
|
||||||
@@ -337,14 +357,19 @@ Define the transaction. Setting the _Flags_ value to _null_ indicates that this
|
|||||||
"TransactionType": "NFTokenCreateOffer",
|
"TransactionType": "NFTokenCreateOffer",
|
||||||
"Account": standby_wallet.classicAddress,
|
"Account": standby_wallet.classicAddress,
|
||||||
"Owner": standbyOwnerField.value,
|
"Owner": standbyOwnerField.value,
|
||||||
"TokenID": standbyTokenIdField.value,
|
"NFTokenID": standbyTokenIdField.value,
|
||||||
"Amount": standbyAmountField.value,
|
"Amount": standbyAmountField.value,
|
||||||
"Flags": null
|
"Flags": null
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
If the expiration date is present, append that to the transaction.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
if (expirationDate != null) {
|
||||||
|
transactionBlob.Expiration = expirationDate
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
Submit the transaction and wait for the results.
|
Submit the transaction and wait for the results.
|
||||||
|
|
||||||
@@ -358,15 +383,12 @@ Request the list of sell offers for the token.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
results += "\n\n***Sell Offers***\n"
|
results += "\n\n***Sell Offers***\n"
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: standbyTokenIdField.value
|
nft_id: standbyTokenIdField.value })
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
}
|
}
|
||||||
@@ -383,13 +405,11 @@ Request the list of buy offers for the token.
|
|||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: standbyTokenIdField.value })
|
nft_id: standbyTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
results += "No buy offers."
|
results += "No buy offers."
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -397,7 +417,6 @@ Report the results of the transaction.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
results += "\n\nTransaction result:\n" +
|
results += "\n\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
@@ -412,8 +431,7 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
```
|
```
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of operationalCreateBuyOffer()
|
}// End of createBuyOffer()
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -426,7 +444,7 @@ Disconnect from the ledger.
|
|||||||
// ******************** Cancel Offer *********************
|
// ******************** Cancel Offer *********************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
async function cancelOffer() {
|
async function cancelOffer() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -461,7 +479,7 @@ Define the transaction.
|
|||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenCancelOffer",
|
"TransactionType": "NFTokenCancelOffer",
|
||||||
"Account": wallet.classicAddress,
|
"Account": wallet.classicAddress,
|
||||||
"TokenOffers": tokenOfferIDs
|
"NFTokenOffers": tokenOfferIDs
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -483,7 +501,7 @@ Request the list of sell offers for the token.
|
|||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: standbyTokenIdField.value
|
nft_id: standbyTokenIdField.value
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
@@ -501,7 +519,7 @@ Request the list of buy offers for the token.
|
|||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: standbyTokenIdField.value })
|
nft_id: standbyTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftBuyOffers = "No buy offers."
|
nftBuyOffers = "No buy offers."
|
||||||
}
|
}
|
||||||
@@ -513,8 +531,6 @@ Report the transaction results.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
results += "\nTransaction result:\n" +
|
results += "\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
results += "\nBalance changes:\n" +
|
results += "\nBalance changes:\n" +
|
||||||
@@ -527,9 +543,8 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
client.disconnect()
|
client.disconnect() // End of cancelOffer()
|
||||||
// End of cancelOffer()
|
}
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -543,10 +558,9 @@ Disconnect from the ledger.
|
|||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
|
||||||
async function getOffers() {
|
async function getOffers() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Get the standby account wallet and connect to the ledger.
|
Get the standby account wallet and connect to the ledger.
|
||||||
|
|
||||||
|
|
||||||
@@ -571,8 +585,7 @@ Request the list of sell offers for the token.
|
|||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: standbyTokenIdField.value
|
nft_id: standbyTokenIdField.value })
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = 'No sell offers.'
|
nftSellOffers = 'No sell offers.'
|
||||||
}
|
}
|
||||||
@@ -590,7 +603,7 @@ Request the list of buy offers for the token.
|
|||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: standbyTokenIdField.value })
|
nft_id: standbyTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftBuyOffers = 'No buy offers.'
|
nftBuyOffers = 'No buy offers.'
|
||||||
}
|
}
|
||||||
@@ -604,10 +617,7 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
```
|
```
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of getOffers()
|
}// End of getOffers()
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -621,7 +631,7 @@ Disconnect from the ledger.
|
|||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
|
||||||
async function acceptSellOffer() {
|
async function acceptSellOffer() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -638,8 +648,6 @@ Get the account wallets and connect to the ledger.
|
|||||||
await client.connect()
|
await client.connect()
|
||||||
results += '\nConnected. Accepting sell offer...\n\n'
|
results += '\nConnected. Accepting sell offer...\n\n'
|
||||||
document.getElementById('standbyResultField').value = results
|
document.getElementById('standbyResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -650,7 +658,7 @@ Define the transaction.
|
|||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenAcceptOffer",
|
"TransactionType": "NFTokenAcceptOffer",
|
||||||
"Account": standby_wallet.classicAddress,
|
"Account": standby_wallet.classicAddress,
|
||||||
"SellOffer": standbyTokenOfferIndexField.value,
|
"NFTokenSellOffer": standbyTokenOfferIndexField.value,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -669,10 +677,7 @@ Request the list of NFTs for the standby account.
|
|||||||
```
|
```
|
||||||
const nfts = await client.request({
|
const nfts = await client.request({
|
||||||
method: "account_nfts",
|
method: "account_nfts",
|
||||||
account: standby_wallet.classicAddress
|
account: standby_wallet.classicAddress })
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -691,15 +696,11 @@ Report the transaction results.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
results += 'Transaction result:\n'
|
results += 'Transaction result:\n'
|
||||||
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
results += '\nBalance changes:'
|
results += '\nBalance changes:'
|
||||||
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
results += JSON.stringify(nfts,null,2)
|
results += JSON.stringify(nfts,null,2)
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('standbyResultField').value = results
|
document.getElementById('standbyResultField').value = results
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -709,8 +710,7 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
```
|
```
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of acceptSellOffer()
|
}// End of acceptSellOffer()
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ Disconnect from the ledger.
|
|||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
|
||||||
async function acceptBuyOffer() {
|
async function acceptBuyOffer() {
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -748,10 +748,9 @@ Prepare the transaction.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
const transactionBlob = {
|
|
||||||
"TransactionType": "NFTokenAcceptOffer",
|
"TransactionType": "NFTokenAcceptOffer",
|
||||||
"Account": standby_wallet.classicAddress,
|
"Account": standby_wallet.classicAddress,
|
||||||
"BuyOffer": standbyTokenOfferIndexField.value
|
"NFTokenBuyOffer": standbyTokenOfferIndexField.value
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -781,9 +780,9 @@ Report the transaction result.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
result += "\n\nTransaction result:\n" +
|
results += "\n\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
result += "\nBalance changes:\n" +
|
results += "\nBalance changes:\n" +
|
||||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -805,8 +804,7 @@ Disconnect from the ledger.
|
|||||||
|
|
||||||
```
|
```
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of acceptBuyOffer()
|
}// End of acceptBuyOffer()
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -820,8 +818,7 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
// *********** Operational Create Sell Offer *************
|
// *********** Operational Create Sell Offer *************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPcreateSellOffer() {
|
||||||
async function oPcreateSellOffer() {
|
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
@@ -832,31 +829,41 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
results += '\nConnected. Creating sell offer...'
|
results += '\nConnected. Creating sell offer...'
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
//------------------------------------- Prepare Expiration Date
|
||||||
|
var expirationDate = null
|
||||||
|
if (operationalExpirationField.value !="") {
|
||||||
|
var days = document.getElementById('operationalExpirationField').value
|
||||||
|
var secondsInDay = 86400
|
||||||
|
var rippleEpoch = 946684800
|
||||||
|
var currentTimestamp = (new Date() / 1000) - rippleEpoch
|
||||||
|
expirationDate = parseInt(Math.floor(currentTimestamp + (days*secondsInDay)))
|
||||||
|
}
|
||||||
// Prepare transaction -------------------------------------------------------
|
// Prepare transaction -------------------------------------------------------
|
||||||
const transactionBlob = {
|
let transactionBlob = {
|
||||||
"TransactionType": "NFTokenCreateOffer",
|
"TransactionType": "NFTokenCreateOffer",
|
||||||
"Account": operational_wallet.classicAddress,
|
"Account": operational_wallet.classicAddress,
|
||||||
"TokenID": operationalTokenIdField.value,
|
"NFTokenID": operationalTokenIdField.value,
|
||||||
"Amount": operationalAmountField.value,
|
"Amount": operationalAmountField.value,
|
||||||
"Flags": parseInt(operationalFlagsField.value)
|
"Flags": parseInt(operationalFlagsField.value),
|
||||||
|
}
|
||||||
|
if (expirationDate != null) {
|
||||||
|
transactionBlob.Expiration = expirationDate
|
||||||
|
}
|
||||||
|
if(standbyDestinationField.value !== '') {
|
||||||
|
transactionBlob.Destination = operationalDestinationField.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Submit transaction --------------------------------------------------------
|
// Submit transaction --------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||||
|
|
||||||
|
|
||||||
results += '\n\n***Sell Offers***\n'
|
results += '\n\n***Sell Offers***\n'
|
||||||
|
|
||||||
|
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: operationalTokenIdField.value
|
nft_id: operationalTokenIdField.value
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
@@ -867,13 +874,12 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: operationalTokenIdField.value })
|
nft_id: operationalTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
results += 'No buy offers.'
|
results += 'No buy offers.'
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
// Check transaction results -------------------------------------------------
|
// Check transaction results -------------------------------------------------
|
||||||
results += '\n\nTransaction result:\n' +
|
results += '\n\nTransaction result:\n' +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
@@ -885,87 +891,88 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
(await client.getXrpBalance(standby_wallet.address))
|
(await client.getXrpBalance(standby_wallet.address))
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
} // End of oPcreateSellOffer()
|
} // End of oPcreateSellOffer()
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// ************** Operational Create Buy Offer ***********
|
// ************** Operational Create Buy Offer ***********
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPcreateBuyOffer() {
|
||||||
async function oPcreateBuyOffer() {
|
|
||||||
|
|
||||||
|
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
const client = new xrpl.Client(net)
|
const client = new xrpl.Client(net)
|
||||||
let results = 'Connecting to ' + net + '...'
|
let results = 'Connecting to ' + getNet() + '...'
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
await client.connect()
|
await client.connect()
|
||||||
results += '\nConnected. Creating buy offer...'
|
results = '\nConnected. Creating buy offer...'
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
//------------------------------------- Prepare Expiration Date
|
||||||
|
var expirationDate = null
|
||||||
|
if (standbyExpirationField.value !="") {
|
||||||
|
var days = document.getElementById('operationalExpirationField').value
|
||||||
|
var secondsInDay = 86400
|
||||||
|
var rippleEpoch = 946684800
|
||||||
|
var currentTimestamp = (new Date() / 1000) - rippleEpoch
|
||||||
|
expirationDate = parseInt(Math.floor(currentTimestamp + (days*secondsInDay)))
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare transaction -------------------------------------------------------
|
// Prepare transaction -------------------------------------------------------
|
||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenCreateOffer",
|
"TransactionType": "NFTokenCreateOffer",
|
||||||
"Account": operational_wallet.classicAddress,
|
"Account": operational_wallet.classicAddress,
|
||||||
"Owner": operationalOwnerField.value,
|
"Owner": operationalOwnerField.value,
|
||||||
"TokenID": operationalTokenIdField.value,
|
"NFTokenID": operationalTokenIdField.value,
|
||||||
"Amount": operationalAmountField.value,
|
"Amount": operationalAmountField.value,
|
||||||
"Flags": null
|
"Flags": null,
|
||||||
|
}
|
||||||
|
if (expirationDate != null) {
|
||||||
|
transactionBlob.Expiration = expirationDate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Submit transaction --------------------------------------------------------
|
// Submit transaction --------------------------------------------------------
|
||||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||||
|
|
||||||
|
results += "\n\n***Sell Offers***\n"
|
||||||
results +="\n\n***Sell Offers***\n"
|
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: operationalTokenIdField.value
|
nft_id: operationalTokenIdField.value
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftSellOffers,null,2)
|
results += JSON.stringify(nftSellOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
results += "\n\n***Buy Offers***\n"
|
results += "\n\n***Buy Offers***\n"
|
||||||
let nftBuyOffers
|
let nftBuyOffers
|
||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: operationalTokenIdField.value })
|
nft_id: operationalTokenIdField.value
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftBuyOffers = "No buy offers."
|
results += "No buy offers."
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
// Check transaction results -------------------------------------------------
|
// Check transaction results -------------------------------------------------
|
||||||
results +="\n\nTransaction result:\n" +
|
results += "\n\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
results += "\n\nBalance changes:\n" +
|
results += "\n\nBalance changes:\n" +
|
||||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
client.disconnect()
|
document.getElementById('operationalResultField').value = results
|
||||||
// End of oPcreateBuyOffer()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
client.disconnect()
|
||||||
|
}// End of oPcreateBuyOffer()
|
||||||
|
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// ************* Operational Cancel Offer ****************
|
// ************* Operational Cancel Offer ****************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPcancelOffer() {
|
||||||
async function oPcancelOffer() {
|
|
||||||
|
|
||||||
|
|
||||||
const wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
const client = new xrpl.Client("wss://xls20-sandbox.rippletest.net:51233")
|
const client = new xrpl.Client("wss://xls20-sandbox.rippletest.net:51233")
|
||||||
@@ -975,26 +982,23 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
results += "\nConnected. Cancelling offer..."
|
results += "\nConnected. Cancelling offer..."
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
const tokenOfferIDs = [operationalTokenOfferIndexField.value]
|
const tokenOfferIDs = [operationalTokenOfferIndexField.value]
|
||||||
|
|
||||||
|
|
||||||
// Prepare transaction -------------------------------------------------------
|
// Prepare transaction -------------------------------------------------------
|
||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenCancelOffer",
|
"TransactionType": "NFTokenCancelOffer",
|
||||||
"Account": wallet.classicAddress,
|
"Account": wallet.classicAddress,
|
||||||
"TokenOffers": tokenOfferIDs
|
"NFTokenOffers": tokenOfferIDs
|
||||||
}
|
}
|
||||||
// Submit transaction --------------------------------------------------------
|
// Submit transaction --------------------------------------------------------
|
||||||
const tx = await client.submitAndWait(transactionBlob,{wallet})
|
const tx = await client.submitAndWait(transactionBlob,{wallet})
|
||||||
|
|
||||||
|
|
||||||
results += "\n\n***Sell Offers***\n"
|
results += "\n\n***Sell Offers***\n"
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: operationalTokenIdField.value
|
nft_id: operationalTokenIdField.value
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = "No sell offers."
|
nftSellOffers = "No sell offers."
|
||||||
@@ -1005,34 +1009,28 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: operationalTokenIdField.value })
|
nft_id: operationalTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftBuyOffers = "No buy offers."
|
nftBuyOffers = "No buy offers."
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
// Check transaction results -------------------------------------------------
|
// Check transaction results -------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
results += "\nTransaction result:\n" +
|
results += "\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
results += "\nBalance changes:\n" +
|
results += "\nBalance changes:\n" +
|
||||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of oPcancelOffer()
|
}// End of oPcancelOffer()
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// **************** Operational Get Offers ***************
|
// **************** Operational Get Offers ***************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPgetOffers() {
|
||||||
async function oPgetOffers() {
|
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
const client = new xrpl.Client(net)
|
const client = new xrpl.Client(net)
|
||||||
@@ -1041,48 +1039,40 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
await client.connect()
|
await client.connect()
|
||||||
results += '\nConnected. Getting offers...'
|
results += '\nConnected. Getting offers...'
|
||||||
|
|
||||||
|
|
||||||
results += '\n\n***Sell Offers***\n'
|
results += '\n\n***Sell Offers***\n'
|
||||||
|
|
||||||
|
|
||||||
let nftSellOffers
|
let nftSellOffers
|
||||||
try {
|
try {
|
||||||
nftSellOffers = await client.request({
|
nftSellOffers = await client.request({
|
||||||
method: "nft_sell_offers",
|
method: "nft_sell_offers",
|
||||||
tokenid: operationalTokenIdField.value
|
nft_id: operationalTokenIdField.value})
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftSellOffers = 'No sell offers.'
|
nftSellOffers = 'No sell offers.'
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftSellOffers,null,2)
|
results += JSON.stringify(nftSellOffers,null,2)
|
||||||
|
|
||||||
|
document.getElementById('standbyResultField').value = results
|
||||||
|
|
||||||
results += '\n\n***Buy Offers***\n'
|
results += '\n\n***Buy Offers***\n'
|
||||||
let nftBuyOffers
|
let nftBuyOffers
|
||||||
try {
|
try {
|
||||||
nftBuyOffers = await client.request({
|
nftBuyOffers = await client.request({
|
||||||
method: "nft_buy_offers",
|
method: "nft_buy_offers",
|
||||||
tokenid: operationalTokenIdField.value })
|
nft_id: operationalTokenIdField.value })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nftBuyOffers = 'No buy offers.'
|
nftBuyOffers = 'No buy offers.'
|
||||||
}
|
}
|
||||||
results += JSON.stringify(nftBuyOffers,null,2)
|
results += JSON.stringify(nftBuyOffers,null,2)
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of oPgetOffers()
|
}// End of oPgetOffers()
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// *************** Operational Accept Sell Offer *********
|
// *************** Operational Accept Sell Offer *********
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPacceptSellOffer() {
|
||||||
async function oPacceptSellOffer() {
|
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
@@ -1090,55 +1080,42 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
results = 'Connecting to ' + getNet() + '...'
|
results = 'Connecting to ' + getNet() + '...'
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
await client.connect()
|
await client.connect()
|
||||||
results = '\nConnected. Accepting sell offer...\n\n'
|
results += '\nConnected. Accepting sell offer...\n\n'
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
// Prepare transaction -------------------------------------------------------
|
// Prepare transaction -------------------------------------------------------
|
||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenAcceptOffer",
|
"TransactionType": "NFTokenAcceptOffer",
|
||||||
"Account": operational_wallet.classicAddress,
|
"Account": operational_wallet.classicAddress,
|
||||||
"SellOffer": operationalTokenOfferIndexField.value,
|
"NFTokenSellOffer": operationalTokenOfferIndexField.value,
|
||||||
}
|
}
|
||||||
// Submit transaction --------------------------------------------------------
|
// Submit transaction --------------------------------------------------------
|
||||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||||
const nfts = await client.request({
|
const nfts = await client.request({
|
||||||
method: "account_nfts",
|
method: "account_nfts",
|
||||||
account: operational_wallet.classicAddress
|
account: operational_wallet.classicAddress })
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// Check transaction results -------------------------------------------------
|
// Check transaction results -------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('standbyBalanceField').value =
|
document.getElementById('standbyBalanceField').value =
|
||||||
(await client.getXrpBalance(standby_wallet.address))
|
(await client.getXrpBalance(standby_wallet.address))
|
||||||
document.getElementById('operationalBalanceField').value =
|
document.getElementById('operationalBalanceField').value =
|
||||||
(await client.getXrpBalance(operational_wallet.address))
|
(await client.getXrpBalance(operational_wallet.address))
|
||||||
|
|
||||||
|
|
||||||
results += 'Transaction result:\n'
|
results += 'Transaction result:\n'
|
||||||
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
results += '\nBalance changes:'
|
results += '\nBalance changes:'
|
||||||
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
results += JSON.stringify(nfts,null,2)
|
results += JSON.stringify(nfts,null,2)
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of acceptSellOffer()
|
}// End of acceptSellOffer()
|
||||||
}
|
|
||||||
|
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// ********* Operational Accept Buy Offer ****************
|
// ********* Operational Accept Buy Offer ****************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
|
|
||||||
|
async function oPacceptBuyOffer() {
|
||||||
async function oPacceptBuyOffer() {
|
|
||||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
@@ -1153,21 +1130,20 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
const transactionBlob = {
|
const transactionBlob = {
|
||||||
"TransactionType": "NFTokenAcceptOffer",
|
"TransactionType": "NFTokenAcceptOffer",
|
||||||
"Account": operational_wallet.classicAddress,
|
"Account": operational_wallet.classicAddress,
|
||||||
"BuyOffer": operationalTokenOfferIndexField.value
|
"NFTokenBuyOffer": operationalTokenOfferIndexField.value
|
||||||
}
|
}
|
||||||
// Submit transaction --------------------------------------------------------
|
// Submit transaction --------------------------------------------------------
|
||||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||||
const nfts = await client.request({
|
const nfts = await client.request({
|
||||||
method: "account_nfts",
|
method: "account_nfts",
|
||||||
account: operational_wallet.classicAddress
|
account: operational_wallet.classicAddress })
|
||||||
})
|
|
||||||
results += JSON.stringify(nfts,null,2)
|
results += JSON.stringify(nfts,null,2)
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
|
|
||||||
// Check transaction results -------------------------------------------------
|
// Check transaction results -------------------------------------------------
|
||||||
result += "\n\nTransaction result:\n" +
|
results += "\n\nTransaction result:\n" +
|
||||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||||
result += "\nBalance changes:\n" +
|
results += "\nBalance changes:\n" +
|
||||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||||
document.getElementById('operationalBalanceField').value =
|
document.getElementById('operationalBalanceField').value =
|
||||||
(await client.getXrpBalance(operational_wallet.address))
|
(await client.getXrpBalance(operational_wallet.address))
|
||||||
@@ -1175,8 +1151,7 @@ These functions duplicate the functions of the standby account for the operation
|
|||||||
(await client.getXrpBalance(standby_wallet.address))
|
(await client.getXrpBalance(standby_wallet.address))
|
||||||
document.getElementById('operationalResultField').value = results
|
document.getElementById('operationalResultField').value = results
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
// End of acceptBuyOffer()
|
}// End of acceptBuyOffer()
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -1187,6 +1162,26 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
<!-- ************************************************************** -->
|
||||||
|
<!-- ********************** The Form ****************************** -->
|
||||||
|
<!-- ************************************************************** -->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Token Test Harness</title>
|
||||||
|
<script src='https://unpkg.com/xrpl@2.2.3'></script>
|
||||||
|
<script src='ripplex1-send-xrp.js'></script>
|
||||||
|
<script src='ripplex2-send-currency.js'></script>
|
||||||
|
<script src='ripplex3-mint-nfts.js'></script>
|
||||||
|
<script src='ripplex4-transfer-nfts.js'></script>
|
||||||
|
<script>
|
||||||
|
if (typeof module !== "undefined") {
|
||||||
|
const xrpl = require('xrpl')
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
<!-- ************************************************************** -->
|
<!-- ************************************************************** -->
|
||||||
<!-- ********************** The Form ****************************** -->
|
<!-- ********************** The Form ****************************** -->
|
||||||
<!-- ************************************************************** -->
|
<!-- ************************************************************** -->
|
||||||
@@ -1290,7 +1285,7 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token URL</td>
|
<td align="right">NFToken URL</td>
|
||||||
<td><input type="text" id="standbyTokenUrlField"
|
<td><input type="text" id="standbyTokenUrlField"
|
||||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||||
</td>
|
</td>
|
||||||
@@ -1300,17 +1295,30 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token ID</td>
|
<td align="right">NFToken ID</td>
|
||||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token Offer Index</td>
|
<td align="right">NFToken Offer Index</td>
|
||||||
<td><input type="text" id="standbyTokenOfferIndexField" value="" size="80"/></td>
|
<td><input type="text" id="standbyTokenOfferIndexField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Owner</td>
|
<td align="right">Owner</td>
|
||||||
<td><input type="text" id="standbyOwnerField" value="" size="80"/></td>
|
<td><input type="text" id="standbyOwnerField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Destination</td>
|
||||||
|
<td><input type="text" id="standbyDestinationField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Expiration</td>
|
||||||
|
<td><input type="text" id="standbyExpirationField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Transfer Fee</td>
|
||||||
|
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||||
@@ -1463,7 +1471,7 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token URL</td>
|
<td align="right">NFToken URL</td>
|
||||||
<td><input type="text" id="operationalTokenUrlField"
|
<td><input type="text" id="operationalTokenUrlField"
|
||||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||||
</td>
|
</td>
|
||||||
@@ -1473,17 +1481,29 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token ID</td>
|
<td align="right">NFToken ID</td>
|
||||||
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Token Offer Index</td>
|
<td align="right">NFToken Offer Index</td>
|
||||||
<td><input type="text" id="operationalTokenOfferIndexField" value="" size="80"/></td>
|
<td><input type="text" id="operationalTokenOfferIndexField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="right">Owner</td>
|
<td align="right">Owner</td>
|
||||||
<td><input type="text" id="operationalOwnerField" value="" size="80"/></td>
|
<td><input type="text" id="operationalOwnerField" value="" size="80"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Destination</td>
|
||||||
|
<td><input type="text" id="operationalDestinationField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Expiration</td>
|
||||||
|
<td><input type="text" id="operationalExpirationField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">Transfer Fee</td>
|
||||||
|
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p align="right">
|
<p align="right">
|
||||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||||
|
|||||||
Reference in New Issue
Block a user