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