mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-22 20:55:50 +00:00
Update set-no-freeze and add more debugging
This commit is contained in:
@@ -15,15 +15,15 @@ async function main() {
|
|||||||
const accountSetTx = {
|
const accountSetTx = {
|
||||||
TransactionType: "AccountSet",
|
TransactionType: "AccountSet",
|
||||||
Account: wallet.address,
|
Account: wallet.address,
|
||||||
|
// Send a flag to turn on a global freeze on this account
|
||||||
SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
|
SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign and submit the settings transaction
|
// Sign and submit the settings transaction
|
||||||
console.log('Sign and submit the transaction:', accountSetTx)
|
console.log('Sign and submit the transaction:', accountSetTx)
|
||||||
|
|
||||||
await client.submitReliable(wallet, accountSetTx)
|
await client.submitReliable(wallet, accountSetTx)
|
||||||
|
|
||||||
client.disconnect()
|
await client.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(console.error)
|
main().catch(console.error)
|
||||||
@@ -74,7 +74,7 @@ async function main() {
|
|||||||
const result = await client.submitReliable(wallet, trust_set)
|
const result = await client.submitReliable(wallet, trust_set)
|
||||||
|
|
||||||
console.log('Submitted tx!')
|
console.log('Submitted tx!')
|
||||||
client.disconnect()
|
await client.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(console.error)
|
main().catch(console.error)
|
||||||
|
|||||||
@@ -1,36 +1,30 @@
|
|||||||
const {RippleAPI} = require('ripple-lib')
|
const xrpl = require('xrpl')
|
||||||
|
|
||||||
const api = new RippleAPI({
|
async function main() {
|
||||||
server: 'wss://s1.ripple.com' // Public rippled server
|
// Connect -------------------------------------------------------------------
|
||||||
})
|
const client = new xrpl.Client('wss://s.altnet.rippletest.net:51233')
|
||||||
api.on('error', (errorCode, errorMessage) => {
|
await client.connect()
|
||||||
|
console.log("Connected to TestNet")
|
||||||
|
|
||||||
|
client.on('error', (errorCode, errorMessage) => {
|
||||||
console.log(errorCode + ': ' + errorMessage)
|
console.log(errorCode + ': ' + errorMessage)
|
||||||
})
|
})
|
||||||
|
|
||||||
const issuing_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v'
|
const { wallet, balance } = await client.fundWallet()
|
||||||
const issuing_secret = 'snnDVkSW3aV6jvMJTPdCiE2Qxv1RW'
|
|
||||||
// Best practice: get your secret from an encrypted
|
|
||||||
// config file instead
|
|
||||||
|
|
||||||
api.connect().then(() => {
|
// Prepare a settings transaction to enable global freeze
|
||||||
|
const accountSetTx = {
|
||||||
// Prepare a settings transaction to enable no freeze
|
TransactionType: "AccountSet",
|
||||||
const settings = {
|
Account: wallet.address,
|
||||||
'noFreeze': true
|
// Set the NoFreeze flag for this account
|
||||||
|
SetFlag: xrpl.AccountSetAsfFlags.asfNoFreeze
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('preparing settings transaction for account:',
|
console.log('Sign and submit the transaction:', accountSetTx)
|
||||||
issuing_address)
|
await client.submitReliable(wallet, accountSetTx)
|
||||||
return api.prepareSettings(issuing_address, settings)
|
|
||||||
|
|
||||||
}).then(prepared_tx => {
|
console.log("Finished submitting. Now disconnecting.")
|
||||||
|
await client.disconnect()
|
||||||
|
}
|
||||||
|
|
||||||
// Sign and submit the settings transaction
|
main().catch(console.error)
|
||||||
console.log('signing tx:', prepared_tx.txJSON)
|
|
||||||
const signed1 = api.sign(prepared_tx.txJSON, issuing_secret)
|
|
||||||
console.log('submitting tx:', signed1.id)
|
|
||||||
|
|
||||||
return api.submit(signed1.signedTransaction)
|
|
||||||
}).then(() => {
|
|
||||||
return api.disconnect()
|
|
||||||
}).catch(console.error)
|
|
||||||
Reference in New Issue
Block a user