Transaction

3034f5c4b895bfe5f4c884c4c4944060a9d537f4681a4a5cd431facfc147f5fb
( - )
226,487
2020-09-24 11:21:38
1
6,784 B

5 Outputs

Total Output:
  • jrunMD{"in":0,"ref":["native://Jig"],"out":["6d812cce83a492d1f7e7878ca22635413dced23636c98917a54ec41d4bcd167b","c6680a76103f85c388d9b2c1729a97279a71b87c62b3427bdfb64a0d7f3cb2ca","1a3fe4fafd0ff6c84cb424311fd28368fc79ca4688141a5552ef092ba5e7b1d6"],"del":[],"cre":["mrRbTfkLtuUhw3jU5BMDxtThBJtw7udAJh","mrRbTfkLtuUhw3jU5BMDxtThBJtw7udAJh","mrRbTfkLtuUhw3jU5BMDxtThBJtw7udAJh"],"exec":[{"op":"DEPLOY","data":["class Wallet_History_Cache extends Jig {\n // check if something is in the cache in O(1) with last_seen_height and if(wallet_history_cache.cache.hasOwnProperty([txhash]))\n init() {\n this.classname = \"Wallet_History_Cache: \"; //\n //this.cache = {}\n\n this.cache = {};\n this.last_seen_height = 0;\n this.length = 0;\n this.cache_ordered_txhash_history = []; // contains array of : {tx_hash: X, height: Y, usertimestamp: Z} // this will come useful once whatsonchain adds pages to their history API or if a wallet contains too much to load fast\n }\n\n get_cache_array() {\n // return the cache as an array instead of an object\n const allkeys = Object.keys(this.cache);\n var cache_array = [];\n\n for (var i = 0; i < allkeys.length; i++) {\n cache_array.push(this.cache[allkeys[i]]);\n }\n\n return cache_array;\n }\n\n add_entries(array_new_entries) {\n var function_id = this.classname + \" add_entries(): \"; // we need to deepcopy because arrays passed as arguments in Run become Proxies that act like jigs so you can't assign them to yourself\n\n function deepcopy(obj) {\n return JSON.parse(JSON.stringify(obj));\n }\n\n array_new_entries = deepcopy(array_new_entries); //console.log(function_id+\" typeof array_new_entries = \"+(typeof array_new_entries))\n\n if (typeof array_new_entries !== 'object') throw new Error(function_id + 'array_new_entries should be object : ', array_new_entries); // throw gives better error trace than expect()\n //console.log(function_id+\" Object.keys(this.cache) : \", Object.keys(this.cache))\n // very important to start by ordering the new_entries by blockheight, in case the loop aborts midway!\n\n array_new_entries.sort(function (a, b) {\n return a.blockheight - b.blockheight;\n });\n\n for (var i = 0; i < array_new_entries.length; i++) {\n var curr_new_entry = array_new_entries[i];\n if (typeof curr_new_entry !== 'object') throw new Error(function_id + 'curr_new_entry should be object : ', curr_new_entry); // throw gives better error trace than expect()\n\n if (!curr_new_entry.blockheight || curr_new_entry.blockheight <= 0) {\n // we should not try to add to cache unconfirmed transactions because blockheight is still unknown\n throw function_id + \" problem with curr_new_entry.blockheight, are you trying to add unconfirmed tx to cache ? : \" + curr_new_entry.blockheight + \" for txhash: \" + curr_new_entry.txhash;\n }\n\n if (!Number.isInteger(curr_new_entry.blockheight)) throw function_id + 'curr_new_entry.blockheight must be an integer : ' + curr_new_entry.blockheight; //\n\n if (this.cache.hasOwnProperty(curr_new_entry.txhash)) throw function_id + \" this txhash is already in cache, aborting : \" + curr_new_entry.txhash; // add to object that acts as an hashtable\n\n this.cache[curr_new_entry.txhash] = curr_new_entry; // add to the cached ordered tx hash history\n\n this.cache_ordered_txhash_history.push({\n tx_hash: curr_new_entry.txhash,\n height: curr_new_entry.blockheight,\n usertimestamp: curr_new_entry.timestamp\n }); //\n // TODO maybe we should re-order the cache_ordered_txhash_history after the for loop ?\n //\n\n this.length++; // update last_seen_height\n\n if (curr_new_entry.blockheight > this.last_seen_height) {\n this.last_seen_height = curr_new_entry.blockheight;\n }\n }\n }\n\n}",{"deps":{"expect":{"$jig":2},"Jig":{"$jig":0}}},"function expect(t){let e=!1;const n=t=>{if(\"object\"!=typeof t||!t)return t;try{return JSON.stringify(t)}catch(e){return t.toString()}};function r(r,o,i){if(e?r:!r)throw new Error(i||`expected value${e?\" not\":\"\"} to be ${o} but was ${n(t)}`)}function o(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(\"object\"!=typeof t)return!1;if(null===t||null===e)return!1;if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;if(!Object.keys(t).every(n=>o(t[n],e[n])))return!1;if(t instanceof Set){if(t.size!==e.size)return!1;if(!o(Array.from(t.entries()),Array.from(e.entries())))return!1}if(t instanceof Map){if(t.size!==e.size)return!1;if(!o(Array.from(t.entries()),Array.from(e.entries())))return!1}return!0}function i(t,e){if(\"function\"!=typeof t)return!1;if(\"function\"!=typeof e)return!1;for(;t;)if((t=Object.getPrototypeOf(t))===e)return!0;return!1}return{get not(){return e=!e,this},toBe:(e,o)=>r(t===e,\"\"+n(e),o),toEqual:(e,i)=>r(o(t,e),\"equal to \"+n(e),i),toBeInstanceOf:(e,n)=>r(t&&t instanceof e,\"an instance of \"+(e&&e.name),n),toBeDefined:e=>r(void 0!==t,\"defined\",e),toBeNull:e=>r(null===t,\"null\",e),toBeNumber:e=>r(\"number\"==typeof t,\"a number\",e),toBeInteger:e=>r(Number.isInteger(t),\"an integer\",e),toBeLessThan:(e,n)=>r(t<e&&\"number\"==typeof t&&\"number\"==typeof e,\"less than \"+e,n),toBeLessThanOrEqualTo:(e,n)=>r(t<=e&&\"number\"==typeof t&&\"number\"==typeof e,\"less than or equal to \"+e,n),toBeGreaterThan:(e,n)=>r(t>e&&\"number\"==typeof t&&\"number\"==typeof e,\"greater than \"+e,n),toBeGreaterThanOrEqualTo:(e,n)=>r(t>=e&&\"number\"==typeof t&&\"number\"==typeof e,\"greater than or equal to \"+e,n),toBeBoolean:e=>r(\"boolean\"==typeof t,\"a boolean\",e),toBeString:e=>r(\"string\"==typeof t,\"a string\",e),toBeObject:e=>r(t&&\"object\"==typeof t,\"an object\",e),toBeArray:e=>r(Array.isArray(t),\"an array\",e),toBeSet:e=>r(t instanceof Set,\"a set\",e),toBeMap:e=>r(t instanceof Map,\"a map\",e),toBeUint8Array:e=>r(t instanceof Uint8Array,\"a uint8array\",e),toBeClass:e=>r(\"function\"==typeof t&&t.toString().startsWith(\"class\"),\"a class\",e),toBeFunction:e=>r(\"function\"==typeof t&&!t.toString().startsWith(\"class\"),\"a function\",e),toBeJigClass:e=>r(\"function\"==typeof t&&t.toString().startsWith(\"class\")&&i(t,Jig),\"a jig class\",e),toExtendFrom:(e,n)=>r(i(t,e),\"an extension of \"+(e&&e.name),n)}}",{"deps":{"Jig":{"$dup":["1","deps","Jig"]}}}]},{"op":"NEW","data":[{"$jig":1},[]]}]}
    https://whatsonchain.com/tx/3034f5c4b895bfe5f4c884c4c4944060a9d537f4681a4a5cd431facfc147f5fb