package com.samourai.wallet.whirlpool;

import android.content.Context;

import com.samourai.wallet.SamouraiWallet;

import org.json.JSONException;
import org.json.JSONObject;

public class WhirlpoolMeta {

    public final static double WHIRLPOOL_FEE_RATE_POOL_DENOMINATION = 0.05;

    private final static int WHIRLPOOL_BADBANK_ACCOUNT = Integer.MAX_VALUE - 3;
    private final static int WHIRLPOOL_PREMIX_ACCOUNT = Integer.MAX_VALUE - 2;
    private final static int WHIRLPOOL_POSTMIX_ACCOUNT = Integer.MAX_VALUE - 1;

    private static WhirlpoolMeta instance = null;

    private static Context context = null;

    private WhirlpoolMeta() { ; }

    public static WhirlpoolMeta getInstance(Context ctx) {

        context = ctx;

        if(instance == null) {
            instance = new WhirlpoolMeta();
        }

        return instance;
    }

    public int getWhirlpoolPremixAccount() {
        return WHIRLPOOL_PREMIX_ACCOUNT;
    }

    public int getWhirlpoolPostmix() {
        return WHIRLPOOL_POSTMIX_ACCOUNT;
    }

    public int getWhirlpoolBadBank() {
        return WHIRLPOOL_BADBANK_ACCOUNT;
    }

}

@@ -517,16 +517,60 @@
 E - 1;%0A%0A
+    private static String strSCODE = null;%0A%0A
     priv
@@ -1162,10 +1162,845 @@
 %0A    %7D%0A%0A
+    public void setSCODE(String scode) %7B%0A        strSCODE = scode;%0A    %7D%0A%0A    public String getSCODE() %7B%0A        return (strSCODE != null && strSCODE.length() %3E 0) ? strSCODE : null;%0A    %7D%0A%0A    public JSONObject toJSON() %7B%0A%0A        JSONObject scode = new JSONObject();%0A%0A        try %7B%0A            if(strSCODE != null && strSCODE.length() %3E 0) %7B%0A                scode.put(%22scode%22, strSCODE);%0A            %7D%0A        %7D%0A        catch(JSONException ex) %7B%0A            throw new RuntimeException(ex);%0A        %7D%0A%0A        return scode;%0A    %7D%0A%0A    public void fromJSON(JSONObject obj) %7B%0A%0A        try %7B%0A            if(obj.has(%22scode%22) && obj.getString(%22scode%22).length() %3E 0) %7B%0A                strSCODE = obj.getString(%22scode%22);%0A            %7D%0A        %7D%0A        catch(JSONException ex) %7B%0A            throw new RuntimeException(ex);%0A        %7D%0A%0A    %7D%0A%0A
 %7D%0A

include SCODE