mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Remove semi-colons
This commit is contained in:
@@ -12,19 +12,19 @@ async function main() {
|
||||
await client.connect()
|
||||
|
||||
client.on('error', (errorCode, errorMessage) => {
|
||||
console.log(errorCode + ': ' + errorMessage);
|
||||
});
|
||||
console.log(errorCode + ': ' + errorMessage)
|
||||
})
|
||||
|
||||
const my_address = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn';
|
||||
|
||||
// Look up settings object
|
||||
const response = await client.request({command: 'account_info', account: my_address });
|
||||
const response = await client.request({command: 'account_info', account: my_address })
|
||||
const settings = response.result
|
||||
|
||||
console.log('Got settings for address', my_address);
|
||||
console.log('Global Freeze enabled?',
|
||||
(settings.globalFreeze === true));
|
||||
console.log('No Freeze enabled?', (settings.noFreeze === true));
|
||||
(settings.globalFreeze === true))
|
||||
console.log('No Freeze enabled?', (settings.noFreeze === true))
|
||||
|
||||
await client.disconnect()
|
||||
}
|
||||
|
||||
@@ -12,28 +12,28 @@ async function main() {
|
||||
await client.connect()
|
||||
|
||||
client.on('error', (errorCode, errorMessage) => {
|
||||
console.log(errorCode + ': ' + errorMessage);
|
||||
});
|
||||
console.log(errorCode + ': ' + errorMessage)
|
||||
})
|
||||
|
||||
const my_address = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn';
|
||||
const counterparty_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v';
|
||||
const frozen_currency = 'USD';
|
||||
const my_address = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn'
|
||||
const counterparty_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v'
|
||||
const frozen_currency = 'USD'
|
||||
|
||||
// Look up current state of trust line
|
||||
const account_lines = {
|
||||
command: 'account_lines',
|
||||
account: my_address,
|
||||
peer: counterparty_address,
|
||||
};
|
||||
}
|
||||
|
||||
console.log('looking up all trust lines from',
|
||||
counterparty_address, 'to', my_address);
|
||||
counterparty_address, 'to', my_address)
|
||||
|
||||
const data = await client.request(account_lines)
|
||||
|
||||
// There is only one trust line per currency code per account,
|
||||
// so we stop after the first match
|
||||
let trustline = null;
|
||||
let trustline = null
|
||||
for (let i = 0; i < data.result.lines.length; i++) {
|
||||
if(data.result.lines[i].currency === frozen_currency) {
|
||||
trustline = data.result.lines[i]
|
||||
@@ -46,9 +46,9 @@ async function main() {
|
||||
}
|
||||
|
||||
console.log('Trust line frozen from our side?',
|
||||
trustline.freeze === true);
|
||||
trustline.freeze === true)
|
||||
console.log('Trust line frozen from counterparty\'s side?',
|
||||
trustline.freeze_peer === true);
|
||||
trustline.freeze_peer === true)
|
||||
|
||||
await client.disconnect()
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ async function main() {
|
||||
await client.connect()
|
||||
|
||||
client.on('error', (errorCode, errorMessage) => {
|
||||
console.log(errorCode + ': ' + errorMessage);
|
||||
});
|
||||
console.log(errorCode + ': ' + errorMessage)
|
||||
})
|
||||
|
||||
const { wallet, balance } = await client.fundWallet()
|
||||
|
||||
@@ -16,12 +16,12 @@ async function main() {
|
||||
TransactionType: "AccountSet",
|
||||
Account: wallet.address,
|
||||
SetFlag: xrpl.AccountSetAsfFlags.asfGlobalFreeze
|
||||
};
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { validate } = require('xrpl');
|
||||
const { validate } = require('xrpl')
|
||||
const xrpl = require('xrpl')
|
||||
|
||||
async function main() {
|
||||
@@ -7,32 +7,32 @@ async function main() {
|
||||
await client.connect()
|
||||
|
||||
client.on('error', (errorCode, errorMessage) => {
|
||||
console.log(errorCode + ': ' + errorMessage);
|
||||
});
|
||||
console.log(errorCode + ': ' + errorMessage)
|
||||
})
|
||||
|
||||
// Generates a test account
|
||||
const { wallet, balance } = await client.fundWallet()
|
||||
|
||||
const issuing_address = wallet.classicAddress
|
||||
const address_to_freeze = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v';
|
||||
const currency_to_freeze = 'USD';
|
||||
const address_to_freeze = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v'
|
||||
const currency_to_freeze = 'USD'
|
||||
|
||||
// Look up current state of trust line
|
||||
const account_lines = {
|
||||
command: 'account_lines',
|
||||
account: issuing_address,
|
||||
peer: address_to_freeze,
|
||||
};
|
||||
}
|
||||
|
||||
console.log('Looking up', currency_to_freeze, 'trust line from',
|
||||
issuing_address, 'to', address_to_freeze);
|
||||
issuing_address, 'to', address_to_freeze)
|
||||
|
||||
const data = await client.request(account_lines)
|
||||
const trustlines = data.result.lines
|
||||
|
||||
// There can only be one trust line per currency code per account,
|
||||
// so we stop after the first match
|
||||
let trustline = null;
|
||||
let trustline = null
|
||||
for (let i = 0; i < trustlines.length; i++) {
|
||||
if(trustlines[i].currency === currency_to_freeze) {
|
||||
trustline = trustlines[i]
|
||||
@@ -40,9 +40,9 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
let limit = null;
|
||||
let limit = null
|
||||
if(trustline === null) {
|
||||
console.log('Trustline not found, making a default one');
|
||||
console.log('Trustline not found, making a default one')
|
||||
|
||||
limit = {
|
||||
value: '0',
|
||||
@@ -70,7 +70,7 @@ async function main() {
|
||||
// For JS users, validate lets you check if your transaction is well-formed
|
||||
validate(trust_set)
|
||||
|
||||
console.log('Submitting TrustSet tx:', trust_set);
|
||||
console.log('Submitting TrustSet tx:', trust_set)
|
||||
const result = await client.submitReliable(wallet, trust_set)
|
||||
|
||||
console.log('Submitted tx!')
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
const {RippleAPI} = require('ripple-lib');
|
||||
const {RippleAPI} = require('ripple-lib')
|
||||
|
||||
const api = new RippleAPI({
|
||||
server: 'wss://s1.ripple.com' // Public rippled server
|
||||
});
|
||||
})
|
||||
api.on('error', (errorCode, errorMessage) => {
|
||||
console.log(errorCode + ': ' + errorMessage);
|
||||
});
|
||||
console.log(errorCode + ': ' + errorMessage)
|
||||
})
|
||||
|
||||
const issuing_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v';
|
||||
const issuing_secret = 'snnDVkSW3aV6jvMJTPdCiE2Qxv1RW';
|
||||
const issuing_address = 'rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v'
|
||||
const issuing_secret = 'snnDVkSW3aV6jvMJTPdCiE2Qxv1RW'
|
||||
// Best practice: get your secret from an encrypted
|
||||
// config file instead
|
||||
|
||||
@@ -17,20 +17,20 @@ api.connect().then(() => {
|
||||
// Prepare a settings transaction to enable no freeze
|
||||
const settings = {
|
||||
'noFreeze': true
|
||||
};
|
||||
}
|
||||
|
||||
console.log('preparing settings transaction for account:',
|
||||
issuing_address);
|
||||
return api.prepareSettings(issuing_address, settings);
|
||||
issuing_address)
|
||||
return api.prepareSettings(issuing_address, settings)
|
||||
|
||||
}).then(prepared_tx => {
|
||||
|
||||
// Sign and submit the settings transaction
|
||||
console.log('signing tx:', prepared_tx.txJSON);
|
||||
const signed1 = api.sign(prepared_tx.txJSON, issuing_secret);
|
||||
console.log('submitting tx:', signed1.id);
|
||||
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);
|
||||
return api.submit(signed1.signedTransaction)
|
||||
}).then(() => {
|
||||
return api.disconnect();
|
||||
}).catch(console.error);
|
||||
return api.disconnect()
|
||||
}).catch(console.error)
|
||||
|
||||
Reference in New Issue
Block a user