3

I am trying to check for various currencies, if they have set the master weight of the source account below the medium threshold of the source account.

According to the documentation that would mean that the source account can no longer issue currency. ( Example 5 here )

For example I would like to check the following issuer:

GD2CLUZYNIGC4RG3ORRBXXMC4HH55U66PK6JNH2R54N52LO6ZUWBUQTO

What are the steps that I need to follow?

Do i need first to find the source account of this issuer and then look for a set option operation, or how exactly does it work?

Thank you.

0

Here is sample code (for JavaScript SDK) to check the basic scenario.

//initialize Horizon server API wrapper
let horizon = new StellarSdk.Server('https://horizon.stellar.org');
//we are going to use Stellar Public network
StellarSdk.Network.usePublicNetwork();

//retrieve recent account information from Horizon
horizon.loadAccount('GD2CLUZYNIGC4RG3ORRBXXMC4HH55U66PK6JNH2R54N52LO6ZUWBUQTO')
    .then(account => {
        const {high_threshold, med_threshold, low_threshold} = account.thresholds

        //calculate the sum of all signers weights
        let totalSignersWeight = account.signers.reduce((res, signer) => res + signer.weight, 0)

        //compare it with med_threshold and high_threshold
        if (totalSignersWeight >= med_threshold || totalSignersWeight >= high_threshold) {
            alert('Account is not locked')            
        } else if (totalSignersWeight >= low_threshold && account.flags.auth_required) {
            alert('Account is locked for issuing, but can authorize trustlines')
        } else {
            alert('Account is locked')
        }
    })
  • Thank you, I had not completely understood the concept, now it makes sense. – S tz Jun 26 '18 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.