Add validate and comment to all transactions

This commit is contained in:
Jackson Mills
2021-10-21 16:34:30 -07:00
parent 18497792fb
commit 10a2365559
5 changed files with 21 additions and 0 deletions

View File

@@ -22,6 +22,9 @@ async function main() {
peer: counterparty_address, peer: counterparty_address,
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(account_lines)
console.log(`Looking up all trust lines from console.log(`Looking up all trust lines from
${counterparty_address} to ${my_address}`) ${counterparty_address} to ${my_address}`)

View File

@@ -22,6 +22,9 @@ async function main() {
SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(accountSetTx)
// Sign and submit the AccountSet transaction to enable a global freeze ------- // Sign and submit the AccountSet transaction to enable a global freeze -------
console.log('Signing and submitting the transaction:', accountSetTx) console.log('Signing and submitting the transaction:', accountSetTx)
await client.submitAndWait(wallet, accountSetTx) await client.submitAndWait(wallet, accountSetTx)
@@ -51,6 +54,9 @@ async function main() {
ClearFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze ClearFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(accountSetTx2)
// Sign and submit the AccountSet transaction to enable a global freeze ------- // Sign and submit the AccountSet transaction to enable a global freeze -------
console.log('Signing and submitting the transaction:', accountSetTx2) console.log('Signing and submitting the transaction:', accountSetTx2)
const result = await client.submitAndWait(wallet, accountSetTx2) const result = await client.submitAndWait(wallet, accountSetTx2)

View File

@@ -22,6 +22,9 @@ async function main() {
SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(accountSetTx)
// Sign and submit the AccountSet transaction to enable a global freeze ------ // Sign and submit the AccountSet transaction to enable a global freeze ------
console.log('Signing and submitting the transaction:', accountSetTx) console.log('Signing and submitting the transaction:', accountSetTx)
await client.submitAndWait(wallet, accountSetTx) await client.submitAndWait(wallet, accountSetTx)
@@ -40,6 +43,9 @@ async function main() {
ClearFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze ClearFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(accountSetTx2)
// Sign and submit the AccountSet transaction to end a global freeze --------- // Sign and submit the AccountSet transaction to end a global freeze ---------
console.log('Signing and submitting the transaction:', accountSetTx2) console.log('Signing and submitting the transaction:', accountSetTx2)
const result = await client.submitAndWait(wallet, accountSetTx2) const result = await client.submitAndWait(wallet, accountSetTx2)

View File

@@ -73,6 +73,9 @@ async function main() {
// Set a flag to freeze the trust line -------------------------------------------- // Set a flag to freeze the trust line --------------------------------------------
trust_set.Flags = xrpl.TrustSetFlags.tfSetFreeze trust_set.Flags = xrpl.TrustSetFlags.tfSetFreeze
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(trust_set)
// Submit a TrustSet transaction to set an individual freeze ---------------------- // Submit a TrustSet transaction to set an individual freeze ----------------------
console.log('Submitting TrustSet tx:', trust_set) console.log('Submitting TrustSet tx:', trust_set)
const result = await client.submitAndWait(wallet, trust_set) const result = await client.submitAndWait(wallet, trust_set)

View File

@@ -23,6 +23,9 @@ async function main() {
SetFlag: xrpl.AccountSetAsfFlags.asfNoFreeze SetFlag: xrpl.AccountSetAsfFlags.asfNoFreeze
} }
// Best practice for JS users - validate checks if a transaction is well-formed
xrpl.validate(accountSetTx)
console.log('Sign and submit the transaction:', accountSetTx) console.log('Sign and submit the transaction:', accountSetTx)
await client.submitAndWait(wallet, accountSetTx) await client.submitAndWait(wallet, accountSetTx)