Created
August 27, 2019 13:20
-
-
Save m-kus/68ba9923a0ddc6765b645d8d2073ee9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from pytezos import pytezos" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"secret = b'\\xbf\\xbb\\xb1o\\xdd\\x0f\\x82,\\x82\\xe4\\x90\\xe1\\x04\\xc2d\\x1b\\x7f\\x96|j\\x87\\x05\\xba=\\xbf\\x15.\\x9d7G\\x13\\x17'" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"ci = pytezos.contract('KT1WhouvVKZFH94VXj9pa8v4szvfrBwXoBUj')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<pytezos.michelson.contract.ContractParameter object at 0x7fb061a03f98>\n", | |
"\n", | |
"$parameter:\n", | |
"\t{ \"ll\": $ll } || \n", | |
"\t{ \"lr\": $bytes /* hashed_secret */ } || \n", | |
"\t{ \"rl\": $bytes /* secret */ } || \n", | |
"\t{ \"rr\": $bytes /* hashed_secret */ }\n", | |
"\n", | |
"$ll:\n", | |
"\t{\n", | |
"\t \"participant\": $address,\n", | |
"\t \"settings\": $settings\n", | |
"\t}\n", | |
"\n", | |
"$settings:\n", | |
"\t{\n", | |
"\t \"hashed_secret\": $bytes,\n", | |
"\t \"refund_time\": $timestamp,\n", | |
"\t \"payoff\": $mutez\n", | |
"\t}\n", | |
"\n", | |
"$timestamp:\n", | |
"\tint /* Unix time in seconds */ ||\n", | |
"\tstring /* Formatted datetime `%Y-%m-%dT%H:%M:%SZ` */\n", | |
"\n", | |
"$bytes:\n", | |
"\tstring /* Hex string */ ||\n", | |
"\tbytes /* Python byte string */\n", | |
"\n", | |
"$address:\n", | |
"\tstring /* Base58 encoded `tz` or `KT` address */\n", | |
"\n", | |
"$mutez:\n", | |
"\tint /* Amount in `utz` (10^-6) */ ||\n", | |
"\tDecimal /* Amount in `tz` */\n", | |
"\n", | |
"\n", | |
"Helpers\n", | |
".decode()\n", | |
".encode()\n", | |
".entries()" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"ci.contract.parameter" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"redeem = ci.using(key='~/Downloads/tz1cnQZXoznhduu4MVWfJF6GSyP6mMHMbbWa.json').rl(secret)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"{'12f64fbad3843c5803aab31f8030304e4ba7688e5b56d39dc6abe8bb3a25254e': None}" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"redeem.result().big_map_diff" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'oomeWo4umG8PCdjckVkKvFHc8ByBo3aA2FeQSsNdP43dyygNpYm'" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"redeem.inject()" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment