tx · 7ZTTgsACCTpLzeE8n5i1yj8TE3iVuFNLq7NzPZd1afkk 3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH: -0.01400000 Waves 2019.12.01 15:16 [789552] smart account 3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH > SELF 0.00000000 Waves
{ "type": 13, "id": "7ZTTgsACCTpLzeE8n5i1yj8TE3iVuFNLq7NzPZd1afkk", "fee": 1400000, "feeAssetId": null, "timestamp": 1575202600025, "version": 1, "sender": "3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH", "senderPublicKey": "GrgrmWgq1Ts1ncMDtq8xzKMBnvc5xPxwkcsK9EN5RskZ", "proofs": [ "4YCeaUautk24Lo3P1qFMpgvSZ8uEPbmeZsFJw5Z3XtkFFCpNY8CfcMFBmY9Wg2GeNcEco3DtQma196zCTEzdneUM" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMICAgAAAAEAQAAAAhnZXRWYWx1ZQAAAAIAAAAEanNvbgAAAANrZXkDCQEAAAACIT0AAAACBQAAAANrZXkCAAAACmZpcnN0X25hbWUJAAACAAAAAQIAAAAfWW91IGNhbm5vdCB1cGRhdGUgdGhpcyBwcm9wZXJ0eQQAAAAIa2V5SW5kZXgJAQAAAAV2YWx1ZQAAAAEJAASzAAAAAgUAAAAEanNvbgkAASwAAAACCQABLAAAAAICAAAAASIFAAAAA2tleQIAAAACIjoEAAAABGRhdGEJAAEwAAAAAgUAAAAEanNvbgkAAGQAAAACCQAAZAAAAAIFAAAACGtleUluZGV4CQABMQAAAAEFAAAAA2tleQAAAAAAAAAAAwUAAAAEZGF0YQEAAAAQZ2V0SnNvbkJlZm9yZUtleQAAAAIAAAAEanNvbgAAAANrZXkDCQEAAAACIT0AAAACBQAAAANrZXkCAAAACmZpcnN0X25hbWUJAAACAAAAAQIAAAAfWW91IGNhbm5vdCB1cGRhdGUgdGhpcyBwcm9wZXJ0eQQAAAAIa2V5SW5kZXgJAQAAAAV2YWx1ZQAAAAEJ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jaDAFAAAAAXMJAAACAAAAAQIAAAAVVGhlIGtleSBkb2Vzbid0IGV4aXN0BAAAAA92YWx1ZUJlZm9yZUpzb24JAQAAABBnZXRKc29uQmVmb3JlS2V5AAAAAgUAAAAJdmFsdWVKU09OBQAAAANrZXkEAAAADnZhbHVlQWZ0ZXJKc29uCQEAAAAPZ2V0SnNvbkFmdGVyS2V5AAAAAwUAAAAJdmFsdWVKU09OBQAAAANrZXkJAAExAAAAAQkBAAAADmdldFZhbHVlU3RyaW5nAAAAAQkBAAAACGdldFZhbHVlAAAAAgUAAAAJdmFsdWVKU09OBQAAAANrZXkEAAAAC3ZhbHVlSW5Kc29uCQEAAAAOZ2V0VmFsdWVTdHJpbmcAAAABCQEAAAAIZ2V0VmFsdWUAAAACBQAAAAl2YWx1ZUpTT04FAAAAA2tleQMJAAAAAAAAAgUAAAALdmFsdWVJbkpzb24FAAAACG5ld1ZhbHVlCQAAAgAAAAECAAAAGHNhbWUgdmFsdWUgc28gbm8gY2hhbmdlcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAHanNvbktleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAA92YWx1ZUJlZm9yZUpzb24CAAAAASIFAAAACG5ld1ZhbHVlAgAAAAEiBQAAAA52YWx1ZUFmdGVySnNvbgUAAAADbmlsAAAAACGy9E8=", "chainId": 84, "height": 789552, "spentComplexity": 0 } View: original | compacted Prev: Am7vtFZ3czuhVuufhPS3aapWf7jn2tMBmPNq6KBmLtFs Next: 5LnkaJJ9WNL5z13vq4zLusQQmJu7Yi1AmF2iNDUi3Hrr Diff:
Old | New | Differences | |
---|---|---|---|
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | + | func getValueString (json) = take(drop(json, 1), value(indexOf(drop(json, 1), "\""))) | |
32 | + | ||
33 | + | ||
31 | 34 | @Callable(i) | |
32 | 35 | func testUpdateJsonKeyValue (jsonKey,key,newValue) = { | |
33 | 36 | let valueJSON = match getString(this, jsonKey) { | |
37 | 40 | throw("The key doesn't exist") | |
38 | 41 | } | |
39 | 42 | let valueBeforeJson = getJsonBeforeKey(valueJSON, key) | |
40 | - | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValue(valueJSON, key))) | |
41 | - | let valueInJson = getValue(valueJSON, key) | |
43 | + | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValueString(getValue(valueJSON, key)))) | |
44 | + | let valueInJson = getValueString(getValue(valueJSON, key)) | |
42 | 45 | if ((valueInJson == newValue)) | |
43 | 46 | then throw("same value so no changes") | |
44 | 47 | else WriteSet([DataEntry(jsonKey, ((((valueBeforeJson + "\"") + newValue) + "\"") + valueAfterJson))]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getValue (json,key) = if ((key != "first_name")) | |
5 | 5 | then throw("You cannot update this property") | |
6 | 6 | else { | |
7 | 7 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
8 | 8 | let data = drop(json, ((keyIndex + size(key)) + 3)) | |
9 | 9 | data | |
10 | 10 | } | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func getJsonBeforeKey (json,key) = if ((key != "first_name")) | |
14 | 14 | then throw("You cannot update this property") | |
15 | 15 | else { | |
16 | 16 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
17 | 17 | let data = take(json, ((keyIndex + size(key)) + 3)) | |
18 | 18 | data | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getJsonAfterKey (json,key,oldValueSize) = if ((key != "first_name")) | |
23 | 23 | then throw("You cannot update this property") | |
24 | 24 | else { | |
25 | 25 | let keyIndex = value(indexOf(json, (("\"" + key) + "\":"))) | |
26 | 26 | let data = takeRight(json, (size(json) - ((((keyIndex + size(key)) + 3) + oldValueSize) + 2))) | |
27 | 27 | data | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | + | func getValueString (json) = take(drop(json, 1), value(indexOf(drop(json, 1), "\""))) | |
32 | + | ||
33 | + | ||
31 | 34 | @Callable(i) | |
32 | 35 | func testUpdateJsonKeyValue (jsonKey,key,newValue) = { | |
33 | 36 | let valueJSON = match getString(this, jsonKey) { | |
34 | 37 | case s: String => | |
35 | 38 | s | |
36 | 39 | case _ => | |
37 | 40 | throw("The key doesn't exist") | |
38 | 41 | } | |
39 | 42 | let valueBeforeJson = getJsonBeforeKey(valueJSON, key) | |
40 | - | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValue(valueJSON, key))) | |
41 | - | let valueInJson = getValue(valueJSON, key) | |
43 | + | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValueString(getValue(valueJSON, key)))) | |
44 | + | let valueInJson = getValueString(getValue(valueJSON, key)) | |
42 | 45 | if ((valueInJson == newValue)) | |
43 | 46 | then throw("same value so no changes") | |
44 | 47 | else WriteSet([DataEntry(jsonKey, ((((valueBeforeJson + "\"") + newValue) + "\"") + valueAfterJson))]) | |
45 | 48 | } | |
46 | 49 | ||
47 | 50 |
github/deemru/w8io/169f3d6 38.42 ms ◑