tx · Am7vtFZ3czuhVuufhPS3aapWf7jn2tMBmPNq6KBmLtFs 3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH: -0.01400000 Waves 2019.12.01 15:13 [789550] smart account 3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH > SELF 0.00000000 Waves
{ "type": 13, "id": "Am7vtFZ3czuhVuufhPS3aapWf7jn2tMBmPNq6KBmLtFs", "fee": 1400000, "feeAssetId": null, "timestamp": 1575202502812, "version": 1, "sender": "3MzFh27duAGxnMitPkGFPWCDHgyYZE3PUCH", "senderPublicKey": "GrgrmWgq1Ts1ncMDtq8xzKMBnvc5xPxwkcsK9EN5RskZ", "proofs": [ "4RAzFYJfHCa74rPfEeptTym3r7EHN5mQFvDTunpQWVvEXuhCyPjPXSFQCoAajhcsETrfcEapuJnFgtwPqctoCi7m" ], "script": "base64:AAIDAAAAAAAAAAkIARIFCgMICAgAAAADAQAAAAhnZXRWYWx1ZQAAAAIAAAAEanNvbgAAAANrZXkDCQEAAAACIT0AAAACBQAAAANrZXkCAAAACmZpcnN0X25hbWUJAAACAAAAAQIAAAAfWW91IGNhbm5vdCB1cGRhdGUgdGhpcyBwcm9wZXJ0eQQAAAAIa2V5SW5kZXgJAQAAAAV2YWx1ZQAAAAEJAASzAAAAAgUAAAAEanNvbgkAASwAAAACCQABLAAAAAICAAAAASIFAAAAA2tleQIAAAACIjoEAAAABGRhdGEJAAEwAAAAAgUAAAAEanNvbgkAAGQAAAACCQAAZAAAAAIFAAAACGtleUluZGV4CQABMQAAAAEFAAAAA2tleQAAAAAAAAAAAwUAAAAEZGF0YQEAAAAQZ2V0SnNvbkJlZm9yZUtleQAAAAIAAAAEanNvbgAAAANrZXkDCQEAAAACIT0AAAACBQAAAANrZXkCAAAACmZpcnN0X25hbWUJAAACAAAAAQIAAAAfWW91IGNhbm5vdCB1cGRhdGUgdGhpcyBwcm9wZXJ0eQQAAAAIa2V5SW5kZXgJAQAAAAV2YWx1ZQAAAAEJAASzAAAAA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0ZXJKc29uCQEAAAAPZ2V0SnNvbkFmdGVyS2V5AAAAAwUAAAAJdmFsdWVKU09OBQAAAANrZXkJAAExAAAAAQkBAAAACGdldFZhbHVlAAAAAgUAAAAJdmFsdWVKU09OBQAAAANrZXkEAAAAC3ZhbHVlSW5Kc29uCQEAAAAIZ2V0VmFsdWUAAAACBQAAAAl2YWx1ZUpTT04FAAAAA2tleQMJAAAAAAAAAgUAAAALdmFsdWVJbkpzb24FAAAACG5ld1ZhbHVlCQAAAgAAAAECAAAAGHNhbWUgdmFsdWUgc28gbm8gY2hhbmdlcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAHanNvbktleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAA92YWx1ZUJlZm9yZUpzb24CAAAAASIFAAAACG5ld1ZhbHVlAgAAAAEiBQAAAA52YWx1ZUFmdGVySnNvbgUAAAADbmlsAAAAAAk3sTc=", "chainId": 84, "height": 789550, "spentComplexity": 0 } View: original | compacted Prev: FVFYycKTKGy9mPknvnoiumLpxaoEq8vtXcFAQNKRdoad Next: 7ZTTgsACCTpLzeE8n5i1yj8TE3iVuFNLq7NzPZd1afkk 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 | - | ||
34 | 31 | @Callable(i) | |
35 | 32 | func testUpdateJsonKeyValue (jsonKey,key,newValue) = { | |
36 | 33 | let valueJSON = match getString(this, jsonKey) { | |
40 | 37 | throw("The key doesn't exist") | |
41 | 38 | } | |
42 | 39 | let valueBeforeJson = getJsonBeforeKey(valueJSON, key) | |
43 | - | let valueAfterJson = getJsonAfterKey(valueJSON, key, size( | |
44 | - | let valueInJson = | |
40 | + | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValue(valueJSON, key))) | |
41 | + | let valueInJson = getValue(valueJSON, key) | |
45 | 42 | if ((valueInJson == newValue)) | |
46 | 43 | then throw("same value so no changes") | |
47 | 44 | 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 | - | ||
34 | 31 | @Callable(i) | |
35 | 32 | func testUpdateJsonKeyValue (jsonKey,key,newValue) = { | |
36 | 33 | let valueJSON = match getString(this, jsonKey) { | |
37 | 34 | case s: String => | |
38 | 35 | s | |
39 | 36 | case _ => | |
40 | 37 | throw("The key doesn't exist") | |
41 | 38 | } | |
42 | 39 | let valueBeforeJson = getJsonBeforeKey(valueJSON, key) | |
43 | - | let valueAfterJson = getJsonAfterKey(valueJSON, key, size( | |
44 | - | let valueInJson = | |
40 | + | let valueAfterJson = getJsonAfterKey(valueJSON, key, size(getValue(valueJSON, key))) | |
41 | + | let valueInJson = getValue(valueJSON, key) | |
45 | 42 | if ((valueInJson == newValue)) | |
46 | 43 | then throw("same value so no changes") | |
47 | 44 | else WriteSet([DataEntry(jsonKey, ((((valueBeforeJson + "\"") + newValue) + "\"") + valueAfterJson))]) | |
48 | 45 | } | |
49 | 46 | ||
50 | 47 |
github/deemru/w8io/169f3d6 56.96 ms ◑