/** * MIT License * Copyright (c) 2018 JCC Dex * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * @author https://github.com/GinMu */ import { exchangeInstance, swtcSequence } from "./util"; import { sign, multiSign } from "./util/sign"; import * as Tx from "./tx"; declare class JCCExchange { private static urls; private static retry; /** * init value of urls and retry * * @static * @param {string[]} urls * @param {number} [retry] default 3 * @memberof JCCExchange */ static init(urls: string[], retry?: number): void; /** * init value of hosts、port、https & retry * * @static * @param {string[]} hosts * @param {(number | string)} port * @param {boolean} https * @param {number} [retry] default 3 * @memberof JCCExchange */ static init(hosts: string[], port: number | string, https: boolean, retry?: number): void; /** * destroy instance of jc exchange * * @static * @memberof JCCExchange */ static destroy(): void; /** * set default chain * * @static * @param {ISupportChain} chain * @memberof JCCExchange */ static setDefaultChain(chain: ISupportChain): void; /** * request sequence * * @static * @param {string} address * @returns {Promise} * @memberof JCCExchange */ static getSequence(address: string): Promise; /** * create order * * @static * @param {string} address address of your jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {string} amount amount of order * @param {string} base token name, if the transaction pair is jjcc-swt, the value of base is "jjcc" * @param {string} counter token name, if the transaction pair is jjcc-swt, the value of counter is "swt" * @param {string} sum the value is the amount multiplied by price * @param {ExchangeType} type the value is "buy" or "sell" * @param {string} platform platform address * @param {string} [issuer="jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"] issuer address of token, the default address is "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or" * @returns {Promise} resolve hash if create success * @memberof JCCExchange */ static createOrder(address: string, secret: string, amount: string, base: string, counter: string, sum: string, type: ExchangeType, platform: string, issuer?: string): Promise; /** * create order and check * * @static * @param {string} address address of your jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {string} amount amount of order * @param {string} base token name, if the transaction pair is jjcc-swt, the value of base is "jjcc" * @param {string} counter token name, if the transaction pair is jjcc-swt, the value of counter is "swt" * @param {string} sum the value is the amount multiplied by price * @param {ExchangeType} type the value is "buy" or "sell" * @param {string} platform platform address * @param {string} [issuer="jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"] issuer address of token, the default address is "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or" * @returns {Promise} resolve hash if create success * @memberof JCCExchange */ static createOrderWithCheck(address: string, secret: string, amount: string, base: string, counter: string, sum: string, type: ExchangeType, platform: string, issuer?: string): Promise; /** * cancel order * * @static * @param {string} address address of your jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {number} offerSequence sequence of order * @returns {Promise} resolve hash if cancel success * @memberof JCCExchange */ static cancelOrder(address: string, secret: string, offerSequence: number): Promise; /** * transfer token * * @static * @param {string} address address of your jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {string} amount transfer amount * @param {(string | IMemo[])} memo transfer memo * @param {string} to destination address of jingtum wallet * @param {string} token token name of transfer * @param {string} [issuer="jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"] issuer address of token, the default address is "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or" * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static transfer(address: string, secret: string, amount: string, memo: string | IMemo[], to: string, token: string, issuer?: string): Promise; /** * transfer token and check * * @static * @param {string} address address of your jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {string} amount transfer amount * @param {(string | IMemo[])} memo transfer memo * @param {string} to destination address of jingtum wallet * @param {string} token token name of transfer * @param {string} [issuer="jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"] issuer address of token, the default address is "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or" * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static transferWithCheck(address: string, secret: string, amount: string, memo: string | IMemo[], to: string, token: string, issuer?: string): Promise; /** * set brokerage * * @static * @param {string} platformAccount platform wallet address * @param {string} platformSecret platform wallet secret * @param {string} feeAccount fee wallet address * @param {number} rateNum fee numerator * @param {number} rateDen fee denominator * @param {string} token token name of transfer * @param {string} [issuer="jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or"] issuer address of token, the default address is "jGa9J9TkqtBcUoHe2zqhVFFbgUVED6o9or" * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static setBrokerage(platformAccount: string, platformSecret: string, feeAccount: string, rateNum: number, rateDen: number, token: string, issuer?: string): Promise; /** * add blackList * * @static * @param {string} address manager wallet address * @param {string} secret manager wallet secret * @param {string} account to be frozen wallet address * @param {(string | IMemo[])} memo transfer memo * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static addBlackList(address: string, secret: string, account: string, memo: string | IMemo[]): Promise; /** * remove blackList * * @static * @param {string} address manager wallet address * @param {string} secret manager wallet secret * @param {string} account to be frozen wallet address * @param {(string | IMemo[])} memo transfer memo * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static removeBlackList(address: string, secret: string, account: string, memo: string | IMemo[]): Promise; /** * remove blackList * * @static * @param {string} address manager wallet address * @param {string} secret manager wallet secret * @param {string} account new issuer wallet address * @param {(string | IMemo[])} memo transfer memo * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static setManageIssuer(address: string, secret: string, account: string, memo: string | IMemo[]): Promise; /** * issueSet pre issue new token * * @static * @param {string} address manager wallet address * @param {string} secret manager wallet secret * @param {string} amount the max amount with pre issue * @param {(string | IMemo[])} memo transfer memo * @param {string} token token name * @param {string} issuer issuer address of token * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static issueSet(address: string, secret: string, amount: string, memo: string | IMemo[], token: string, issuer: any): Promise; /** * enable/disable multi-sign account, signerQuorum is zero means disable * * @static * @param {string} address multi-sign jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {number} signerQuorum threshold of voting * @param {ISignerEntry[]} signerEntries list of signer account and weight * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static setSignerList(address: string, secret: string, signerQuorum: number, signerEntries?: ISignerEntry[]): Promise; /** * enable/disable account master key * * @static * @param {string} address multi-sign jingtum wallet * @param {string} secret secret of your jingtum wallet * @param {number} signerQuorum threshold of voting * @param {ISignerEntry[]} signerEntries list of signer account and weight * @returns {Promise} resolve hash if transfer success * @memberof JCCExchange */ static setAccount(address: string, secret: string, disable: boolean): Promise; /** * send raw transaction * * @protected * @static * @param {string} blob * @param {(signature: string) => Promise} [callback] * @returns {Promise} * @memberof JCCExchange */ static sendRawTransaction(blob: string, callback?: (signature: string) => Promise): Promise; /** * submit transaction * * @protected * @static * @param {string} secret * @param {(ICancelExchange | ICreateExchange | IPayExchange) | IBrokerageExchange | ISignerListSet | IAccountSet} tx * @param {(signature: string) => Promise} callback * @returns {Promise} * @memberof JCCExchange */ protected static submit(secret: string, tx: ICancelExchange | ICreateExchange | IPayExchange | IBrokerageExchange | ISignerListSet | IAccountSet, callback: (signature: string) => Promise): Promise; protected static submitBlob(blob: string, callback: (signature: string) => Promise): Promise; } export default JCCExchange; export { JCCExchange, Tx, sign, multiSign, exchangeInstance, swtcSequence };