diff --git a/crypto777/tools/common.mk b/crypto777/tools/common.mk index 114a49256..1aa7ab4e6 100644 --- a/crypto777/tools/common.mk +++ b/crypto777/tools/common.mk @@ -32,9 +32,12 @@ TOP_MAKE := $(word 1,$(MAKEFILE_LIST)) # # Figure out which OS we are running on. # -GETOS := python $(NACL_SDK_ROOT)/tools/getos.py -NACL_CONFIG := python $(NACL_SDK_ROOT)/tools/nacl_config.py -FIXDEPS := python $(NACL_SDK_ROOT)/tools/fix_deps.py -c +#GETOS := python $(NACL_SDK_ROOT)/tools/getos.py +#NACL_CONFIG := python $(NACL_SDK_ROOT)/tools/nacl_config.py +#FIXDEPS := python $(NACL_SDK_ROOT)/tools/fix_deps.py -c +GETOS := python tools/getos.py +NACL_CONFIG := python tools/nacl_config.py +FIXDEPS := python tools/fix_deps.py -c OSNAME := $(shell $(GETOS)) diff --git a/crypto777/tools/fix_deps.py b/crypto777/tools/fix_deps.py new file mode 100755 index 000000000..f5a9cc8af --- /dev/null +++ b/crypto777/tools/fix_deps.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Fixup GCC-generated dependency files. + +Modify GCC generated dependency files so they are more suitable for including +in a GNU Makefile. Without the fixups, deleting or renaming headers can cause +the build to be broken. + +See http://mad-scientist.net/make/autodep.html for more details of the problem. +""" + +import argparse +import os +import sys + +TAG_LINE = '# Updated by fix_deps.py\n' + + +class Error(Exception): + pass + + +def ParseLine(line, new_target): + """Parse one line of a GCC-generated deps file. + + Each line contains an optional target and then a list + of space seperated dependencies. Spaces within filenames + are escaped with a backslash. + """ + filenames = [] + + if new_target and ':' in line: + line = line.split(':', 1)[1] + + line = line.strip() + line = line.rstrip('\\') + + while True: + # Find the next non-escaped space + line = line.strip() + pos = line.find(' ') + while pos > 0 and line[pos-1] == '\\': + pos = line.find(' ', pos+1) + + if pos == -1: + filenames.append(line) + break + filenames.append(line[:pos]) + line = line[pos+1:] + + return filenames + + +def FixupDepFile(filename, output_filename=None): + if not os.path.exists(filename): + raise Error('File not found: %s' % filename) + + if output_filename is None: + output_filename = filename + + outlines = [TAG_LINE] + deps = [] + new_target = True + with open(filename) as infile: + for line in infile: + if line == TAG_LINE: + raise Error('Already processed: %s' % filename) + outlines.append(line) + deps += ParseLine(line, new_target) + new_target = line.endswith('\\') + + # For every depenency found output a dummy target with no rules + for dep in deps: + outlines.append('%s:\n' % dep) + + with open(output_filename, 'w') as outfile: + for line in outlines: + outfile.write(line) + + +def main(argv): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('-o', '--output', help='Output filename (defaults to ' + 'input name with .deps extension') + parser.add_argument('-c', '--clean', action='store_true', + help='Remove input file after writing output') + parser.add_argument('dep_file') + options = parser.parse_args(argv) + output_filename = options.output + if not output_filename: + output_filename = os.path.splitext(options.dep_file)[0] + '.deps' + FixupDepFile(options.dep_file, output_filename) + if options.clean and options.dep_file != output_filename: + os.remove(options.dep_file) + + return 0 + + +if __name__ == '__main__': + try: + sys.exit(main(sys.argv[1:])) + except Error as e: + sys.stderr.write('%s: %s\n' % (os.path.basename(__file__), e)) + sys.exit(1) diff --git a/crypto777/tools/nacl_config.py b/crypto777/tools/nacl_config.py new file mode 100755 index 000000000..146563be4 --- /dev/null +++ b/crypto777/tools/nacl_config.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A helper script to print paths of NaCl binaries, includes, libs, etc. + +It is similar in behavior to pkg-config or sdl-config. +""" + +import argparse +import os +import posixpath +import sys + +import getos + + +if sys.version_info < (2, 7, 0): + sys.stderr.write("python 2.7 or later is required run this script\n") + sys.exit(1) + + +VALID_ARCHES = ('arm', 'x86_32', 'x86_64', 'i686') +VALID_PNACL_ARCHES = (None, 'pnacl') +ARCH_NAME = { + 'arm': 'arm', + 'x86_32': 'i686', + 'i686': 'i686', + 'x86_64': 'x86_64' +} + +ARCH_ALT_NAME = { + 'arm': 'arm', + 'x86_32': 'x86_32', + 'i686': 'x86_32', + 'x86_64': 'x86_64' +} + +ARCH_BASE_NAME = { + 'arm': 'arm', + 'x86_32': 'x86', + 'i686': 'x86', + 'x86_64': 'x86' +} + +NACL_TOOLCHAINS = ('newlib', 'glibc', 'pnacl', 'bionic', 'clang-newlib') +HOST_TOOLCHAINS = ('linux', 'mac', 'win') +VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] + +# This is not an exhaustive list of tools, just the ones that need to be +# special-cased. + +# e.g. For PNaCL cc => pnacl-clang +# For NaCl cc => pnacl-gcc +# +# Most tools will be passed through directly. +# e.g. For PNaCl foo => pnacl-foo +# For NaCl foo => x86_64-nacl-foo. +CLANG_TOOLS = { + 'cc': 'clang', + 'c++': 'clang++', + 'gcc': 'clang', + 'g++': 'clang++', + 'ld': 'clang++' +} + +GCC_TOOLS = { + 'cc': 'gcc', + 'c++': 'g++', + 'gcc': 'gcc', + 'g++': 'g++', + 'ld': 'g++' +} + + +class Error(Exception): + pass + + +def Expect(condition, message): + if not condition: + raise Error(message) + + +def ExpectToolchain(toolchain, expected_toolchains): + Expect(toolchain in expected_toolchains, + 'Expected toolchain to be one of [%s], not %s.' % ( + ', '.join(expected_toolchains), toolchain)) + + +def ExpectArch(arch, expected_arches): + Expect(arch in expected_arches, + 'Expected arch to be one of [%s], not %s.' % ( + ', '.join(map(str, expected_arches)), arch)) + + +def CheckValidToolchainArch(toolchain, arch, arch_required=False): + if toolchain or arch or arch_required: + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + + if toolchain in HOST_TOOLCHAINS: + Expect(arch is None, + 'Expected no arch for host toolchain %r. Got %r.' % ( + toolchain, arch)) + elif toolchain == 'pnacl': + Expect(arch is None or arch == 'pnacl', + 'Expected no arch for toolchain %r. Got %r.' % (toolchain, arch)) + elif arch_required: + Expect(arch is not None, + 'Expected arch to be one of [%s] for toolchain %r.\n' + 'Use the -a or --arch flags to specify one.\n' % ( + ', '.join(VALID_ARCHES), toolchain)) + + if arch: + if toolchain == 'pnacl': + ExpectArch(arch, VALID_PNACL_ARCHES) + else: + ExpectArch(arch, VALID_ARCHES) + + if arch == 'arm': + Expect(toolchain in ['newlib', 'bionic', 'clang-newlib'], + 'The arm arch only supports newlib.') + + +def GetArchName(arch): + return ARCH_NAME.get(arch) + + +def GetArchAltName(arch): + return ARCH_ALT_NAME.get(arch) + + +def GetArchBaseName(arch): + return ARCH_BASE_NAME.get(arch) + + +def CanonicalizeToolchain(toolchain): + if toolchain == 'host': + return getos.GetPlatform() + return toolchain + + +def GetPosixSDKPath(): + sdk_path = getos.GetSDKPath() + if getos.GetPlatform() == 'win': + return sdk_path.replace('\\', '/') + else: + return sdk_path + + +def GetToolchainDir(toolchain, arch=None): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + root = GetPosixSDKPath() + platform = getos.GetPlatform() + if toolchain in ('pnacl', 'clang-newlib'): + subdir = '%s_pnacl' % platform + else: + assert arch is not None + subdir = '%s_%s_%s' % (platform, GetArchBaseName(arch), toolchain) + + return posixpath.join(root, 'toolchain', subdir) + + +def GetToolchainArchDir(toolchain, arch): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + assert arch is not None + toolchain_dir = GetToolchainDir(toolchain, arch) + arch_dir = '%s-nacl' % GetArchName(arch) + return posixpath.join(toolchain_dir, arch_dir) + + +def GetToolchainBinDir(toolchain, arch=None): + ExpectToolchain(toolchain, NACL_TOOLCHAINS) + return posixpath.join(GetToolchainDir(toolchain, arch), 'bin') + + +def GetSDKIncludeDirs(toolchain): + root = GetPosixSDKPath() + base_include = posixpath.join(root, 'include') + if toolchain == 'clang-newlib': + toolchain = 'newlib' + return [base_include, posixpath.join(base_include, toolchain)] + + +def GetSDKLibDir(): + return posixpath.join(GetPosixSDKPath(), 'lib') + + +# Commands + +def GetToolPath(toolchain, arch, tool): + if tool == 'gdb': + # Always use the same gdb; it supports multiple toolchains/architectures. + # NOTE: this is always a i686 executable. i686-nacl-gdb is a symlink to + # x86_64-nacl-gdb. + return posixpath.join(GetToolchainBinDir('newlib', 'x86_64'), + 'x86_64-nacl-gdb') + + if toolchain == 'pnacl': + CheckValidToolchainArch(toolchain, arch) + tool = CLANG_TOOLS.get(tool, tool) + full_tool_name = 'pnacl-%s' % tool + else: + CheckValidToolchainArch(toolchain, arch, arch_required=True) + ExpectArch(arch, VALID_ARCHES) + if toolchain == 'clang-newlib': + tool = CLANG_TOOLS.get(tool, tool) + else: + tool = GCC_TOOLS.get(tool, tool) + full_tool_name = '%s-nacl-%s' % (GetArchName(arch), tool) + return posixpath.join(GetToolchainBinDir(toolchain, arch), full_tool_name) + + +def GetCFlags(toolchain): + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + return ' '.join('-I%s' % dirname for dirname in GetSDKIncludeDirs(toolchain)) + + +def GetIncludeDirs(toolchain): + ExpectToolchain(toolchain, VALID_TOOLCHAINS) + return ' '.join(GetSDKIncludeDirs(toolchain)) + + +def GetLDFlags(): + return '-L%s' % GetSDKLibDir() + + +def main(args): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('-t', '--toolchain', help='toolchain name. This can also ' + 'be specified with the NACL_TOOLCHAIN environment ' + 'variable.') + parser.add_argument('-a', '--arch', help='architecture name. This can also ' + 'be specified with the NACL_ARCH environment variable.') + + group = parser.add_argument_group('Commands') + group.add_argument('--tool', help='get tool path') + group.add_argument('--cflags', + help='output all preprocessor and compiler flags', + action='store_true') + group.add_argument('--libs', '--ldflags', help='output all linker flags', + action='store_true') + group.add_argument('--include-dirs', + help='output include dirs, separated by spaces', + action='store_true') + + options = parser.parse_args(args) + + # Get toolchain/arch from environment, if not specified on commandline + options.toolchain = options.toolchain or os.getenv('NACL_TOOLCHAIN') + options.arch = options.arch or os.getenv('NACL_ARCH') + + options.toolchain = CanonicalizeToolchain(options.toolchain) + CheckValidToolchainArch(options.toolchain, options.arch) + + if options.cflags: + print GetCFlags(options.toolchain) + elif options.include_dirs: + print GetIncludeDirs(options.toolchain) + elif options.libs: + print GetLDFlags() + elif options.tool: + print GetToolPath(options.toolchain, options.arch, options.tool) + else: + parser.error('Expected a command. Run with --help for more information.') + + return 0 + + +if __name__ == '__main__': + try: + sys.exit(main(sys.argv[1:])) + except Error as e: + sys.stderr.write(str(e) + '\n') + sys.exit(1) diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index bd9a38a37..1af5edca8 100644 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -91,7 +91,7 @@ int32_t SuperNET_confirmip(struct supernet_info *myinfo,uint32_t ipbits) return(total); } -void SuperNET_myipaddr(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *myipaddr,char *remoteaddr) +void SuperNET_checkipaddr(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *myipaddr,char *remoteaddr) { uint32_t myipbits = (uint32_t)calc_ipbits(myipaddr); if ( addr->myipbits == 0 ) @@ -773,7 +773,7 @@ char *SuperNET_p2p(struct iguana_info *coin,struct iguana_peer *addr,int32_t *de if ( 0 && jstr(json,"method") != 0 && strcmp(jstr(json,"method"),"getpeers") != 0 ) printf("GOT >>>>>>>> SUPERNET P2P.(%s) from.%s %s valid.%d:%d\n",jprint(json,0),coin->symbol,addr->ipaddr,addr->validpub,addr->othervalid); if ( (myipaddr= jstr(json,"yourip")) != 0 ) - SuperNET_myipaddr(SuperNET_MYINFO(0),coin,addr,myipaddr,ipaddr); + SuperNET_checkipaddr(SuperNET_MYINFO(0),coin,addr,myipaddr,ipaddr); jaddstr(json,"fromp2p",coin->symbol); method = jstr(json,"method"); if ( method != 0 && strcmp(method,"stop") == 0 ) @@ -1241,6 +1241,24 @@ STRING_ARG(SuperNET,wif2priv,wif) return(jprint(retjson,1)); } +ZERO_ARGS(SuperNET,myipaddr) +{ + cJSON *retjson = cJSON_CreateObject(); + jaddstr(retjson,"result",myinfo->ipaddr); + return(jprint(retjson,1)); +} + +STRING_ARG(SuperNET,setmyipaddr,ipaddr) +{ + cJSON *retjson = cJSON_CreateObject(); + if ( is_ipaddr(ipaddr) != 0 ) + { + strcpy(myinfo->ipaddr,ipaddr); + jaddstr(retjson,"result",myinfo->ipaddr); + } else jaddstr(retjson,"error","illegal ipaddr"); + return(jprint(retjson,1)); +} + STRING_ARG(SuperNET,utime2utc,utime) { uint32_t utc = 0; cJSON *retjson = cJSON_CreateObject(); diff --git a/iguana/SuperNET.h b/iguana/SuperNET.h index 3fef1fb84..55f27d4f5 100644 --- a/iguana/SuperNET.h +++ b/iguana/SuperNET.h @@ -84,27 +84,11 @@ struct supernet_info int32_t LBsock,PUBsock,reqsock,subsock,networktimeout,maxdelay; uint16_t LBport,PUBport,reqport,subport; struct nn_pollfd pfd[SUPERNET_MAXAGENTS]; //struct relay_info active; - struct supernet_agent agents[SUPERNET_MAXAGENTS]; queue_t acceptQ,acceptableQ; + struct supernet_agent agents[SUPERNET_MAXAGENTS]; queue_t acceptQ; int32_t numagents,numexchanges; struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; char handle[1024]; }; -#define NXT_ASSETID ('N' + ((uint64_t)'X'<<8) + ((uint64_t)'T'<<16)) // 5527630 -#define INSTANTDEX_ACCT "4383817337783094122" -union _NXT_tx_num { int64_t amountNQT; int64_t quantityQNT; }; -struct NXT_tx -{ - bits256 refhash,sighash,fullhash; - uint64_t senderbits,recipientbits,assetidbits,txid,priceNQT,quoteid; - int64_t feeNQT; - union _NXT_tx_num U; - int32_t deadline,type,subtype,verify,number; - uint32_t timestamp; - char comment[4096]; -}; -uint64_t set_NXTtx(struct supernet_info *myinfo,struct NXT_tx *tx,uint64_t assetidbits,int64_t amount,uint64_t other64bits,int32_t feebits); -cJSON *gen_NXT_tx_json(struct supernet_info *myinfo,char *fullhash,struct NXT_tx *utx,char *reftxid,double myshare); -int32_t calc_raw_NXTtx(struct supernet_info *myinfo,char *fullhash,char *utxbytes,char *sighash,uint64_t assetidbits,int64_t amount,uint64_t other64bits); /*struct supernet_endpoint { @@ -183,7 +167,6 @@ double instantdex_aveprice(struct supernet_info *myinfo,struct exchange_quote *s void SuperNET_setkeys(struct supernet_info *myinfo,void *pass,int32_t passlen,int32_t dosha256); char *InstantDEX_hexmsg(struct supernet_info *myinfo,void *data,int32_t len,char *remoteaddr); -double instantdex_acceptable(struct supernet_info *myinfo,cJSON *array,char *refstr,char *base,char *rel,double volume); #endif diff --git a/iguana/exchanges/bitcoin.c b/iguana/exchanges/bitcoin.c index cd094d3b9..a18db78ca 100755 --- a/iguana/exchanges/bitcoin.c +++ b/iguana/exchanges/bitcoin.c @@ -350,6 +350,7 @@ int32_t bitcoin_MofNspendscript(uint8_t p2sh_rmd160[20],uint8_t *script,int32_t { if ( (plen= bitcoin_pubkeylen(vp->signers[i].pubkey)) < 0 ) return(-1); + script[n++] = plen; memcpy(&script[n],vp->signers[i].pubkey,plen); n += plen; } @@ -620,7 +621,18 @@ int32_t iguana_calcrmd160(struct iguana_info *coin,struct vin_info *vp,uint8_t * scriptlen = iguana_scriptgen(coin,&vp->M,&vp->N,vp->coinaddr,script,asmstr,vp->rmd160,vp->type,(const struct vin_info *)vp,vout); if ( scriptlen != pk_scriptlen || memcmp(script,pk_script,scriptlen) != 0 ) { - printf("iguana_calcrmd160 type.%d error regenerating scriptlen.%d vs %d\n",vp->type,scriptlen,pk_scriptlen); + if ( vp->type != IGUANA_SCRIPT_OPRETURN ) + { + int32_t i; + printf("\n--------------------\n"); + for (i=0; itype,scriptlen,pk_scriptlen); + } } } return(vp->type); @@ -1340,23 +1352,21 @@ rawtxstr = refstr; #define FUNCS bitcoin ## _funcs #define BASERELS bitcoin ## _baserels -static char *BASERELS[][2] = { {"btc","nxt"}, {"btc","btcd"}, {"btc","ltc"}, {"btc","vrc"}, {"btc","doge"} }; +static char *BASERELS[][2] = { {"btcd","btc"}, {"nxt","btc"}, {"asset","btc"} }; #include "exchange_supports.h" -double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *quotes,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) -{ - char url[1024],lrel[16],lbase[16]; - strcpy(lrel,rel), strcpy(lbase,base); - tolowercase(lrel), tolowercase(lbase); - sprintf(url,"http://api.quadrigacx.com/v2/order_book?book=%s_%s",lbase,lrel); - return(exchanges777_standardprices(exchange,commission,base,rel,url,quotes,0,0,maxdepth,0,invert)); -} - -cJSON *SIGNPOST(void **cHandlep,int32_t dotrade,char **retstrp,struct exchange_info *exchange,char *payload,char *path) +double UPDATE(struct exchange_info *exchange,char *base,char *rel,struct exchange_quote *bidasks,int32_t maxdepth,double commission,cJSON *argjson,int32_t invert) { - if ( retstrp != 0 ) - *retstrp = clonestr("{\"error\":\"bitcoin is not yet\"}"); - return(cJSON_Parse("{}")); + cJSON *retjson,*bids,*asks; double hbla; + bids = cJSON_CreateArray(); + asks = cJSON_CreateArray(); + instantdex_acceptablefind(exchange,bids,asks,0,base,rel); + retjson = cJSON_CreateObject(); + cJSON_AddItemToObject(retjson,"bids",bids); + cJSON_AddItemToObject(retjson,"asks",asks); + hbla = exchanges777_json_orderbook(exchange,commission,base,rel,bidasks,maxdepth,retjson,0,"bids","asks",0,0,invert); + free_json(retjson); + return(hbla); } char *PARSEBALANCE(struct exchange_info *exchange,double *balancep,char *coinstr,cJSON *argjson) @@ -1374,22 +1384,40 @@ uint64_t TRADE(int32_t dotrade,char **retstrp,struct exchange_info *exchange,cha return(0); } -char *ORDERSTATUS(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson) +char *ORDERSTATUS(struct exchange_info *exchange,uint64_t orderid,cJSON *argjson) { - return(clonestr("{\"error\":\"bitcoin is not yet\"}")); + struct instantdex_accept *ap; cJSON *retjson; + if ( (ap= instantdex_acceptablefind(exchange,0,0,orderid,"*","*")) != 0 ) + { + retjson = cJSON_CreateObject(); + jadd(retjson,"result",instantdex_acceptjson(ap)); + return(jprint(retjson,1)); + } else return(clonestr("{\"error\":\"couldnt find orderid\"}")); } -char *CANCELORDER(struct exchange_info *exchange,uint64_t quoteid,cJSON *argjson) +char *CANCELORDER(struct exchange_info *exchange,uint64_t orderid,cJSON *argjson) { - return(clonestr("{\"error\":\"bitcoin is not yet\"}")); + struct instantdex_accept *ap; cJSON *retjson; + if ( (ap= instantdex_acceptablefind(exchange,0,0,orderid,"*","*")) != 0 ) + { + ap->dead = (uint32_t)time(NULL); + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","killed orderid, but might have pending"); + jadd(retjson,"order",instantdex_acceptjson(ap)); + return(jprint(retjson,1)); + } else return(clonestr("{\"error\":\"couldnt find orderid\"}")); } char *OPENORDERS(struct exchange_info *exchange,cJSON *argjson) { - cJSON *retjson,*array = cJSON_CreateArray(); + cJSON *retjson,*bids,*asks; + bids = cJSON_CreateArray(); + asks = cJSON_CreateArray(); + instantdex_acceptablefind(exchange,bids,asks,0,"*","*"); retjson = cJSON_CreateObject(); - instantdex_acceptable(SuperNET_MYINFO(0),array,"","*","*",0); - jadd(retjson,"result",array); + jaddstr(retjson,"result","success"); + jadd(retjson,"bids",bids); + jadd(retjson,"asks",asks); return(jprint(retjson,1)); } diff --git a/iguana/exchanges777.h b/iguana/exchanges777.h index c742bb58b..1c46ddf03 100755 --- a/iguana/exchanges777.h +++ b/iguana/exchanges777.h @@ -50,7 +50,7 @@ struct exchange_info uint32_t exchangeid,pollgap,lastpoll; uint64_t lastnonce,exchangebits; double commission; void *privatedata; - CURL *cHandle; queue_t requestQ,pricesQ,pendingQ[2],tradebotsQ; + CURL *cHandle; queue_t requestQ,pricesQ,pendingQ[2],tradebotsQ,acceptableQ; }; struct instantdex_msghdr @@ -60,6 +60,23 @@ struct instantdex_msghdr uint8_t serialized[]; } __attribute__((packed)); +#define NXT_ASSETID ('N' + ((uint64_t)'X'<<8) + ((uint64_t)'T'<<16)) // 5527630 +#define INSTANTDEX_ACCT "4383817337783094122" +union _NXT_tx_num { int64_t amountNQT; int64_t quantityQNT; }; +struct NXT_tx +{ + bits256 refhash,sighash,fullhash; + uint64_t senderbits,recipientbits,assetidbits,txid,priceNQT,quoteid; + int64_t feeNQT; + union _NXT_tx_num U; + int32_t deadline,type,subtype,verify,number; + uint32_t timestamp; + char comment[4096]; +}; +uint64_t set_NXTtx(struct supernet_info *myinfo,struct NXT_tx *tx,uint64_t assetidbits,int64_t amount,uint64_t other64bits,int32_t feebits); +cJSON *gen_NXT_tx_json(struct supernet_info *myinfo,char *fullhash,struct NXT_tx *utx,char *reftxid,double myshare); +int32_t calc_raw_NXTtx(struct supernet_info *myinfo,char *fullhash,char *utxbytes,char *sighash,uint64_t assetidbits,int64_t amount,uint64_t other64bits); + struct exchange_request { struct queueitem DL; @@ -71,6 +88,13 @@ struct exchange_request struct exchange_quote bidasks[]; }; +struct instantdex_entry { char base[24],rel[24]; double price,basevolume,pendingvolume; uint32_t expiration,nonce; char myside,acceptdir; }; +struct instantdex_accept { struct queueitem DL; uint64_t orderid; uint32_t dead; struct instantdex_entry A; }; + +struct instantdex_accept *instantdex_acceptablefind(struct exchange_info *exchange,cJSON *bids,cJSON *asks,uint64_t orderid,char *base,char *rel); +cJSON *instantdex_acceptjson(struct instantdex_accept *ap); +struct instantdex_accept *instantdex_acceptable(struct exchange_info *exchange,cJSON *array,char *refstr,char *base,char *rel,char *offerside,int32_t offerdir,double offerprice,double volume); + void *curl_post(void **cHandlep,char *url,char *userpass,char *postfields,char *hdr0,char *hdr1,char *hdr2,char *hdr3); char *instantdex_sendcmd(struct supernet_info *myinfo,cJSON *argjson,char *cmdstr,char *ipaddr,int32_t hops); char *exchanges777_Qprices(struct exchange_info *exchange,char *base,char *rel,int32_t maxseconds,int32_t allfields,int32_t depth,cJSON *argjson,int32_t monitor,double commission); diff --git a/iguana/help/header.html b/iguana/help/header.html index bf3836284..c53a53fd2 100644 --- a/iguana/help/header.html +++ b/iguana/help/header.html @@ -5,7 +5,7 @@ - SuperNET API> + SuperNET API Page> @@ -15,8 +15,8 @@ @@ -30,7 +30,7 @@