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
| from iconservice import * | |
| TAG = 'SampleToken' | |
| # An interface of ICON Token Standard, IRC-2 | |
| class TokenStandard(ABC): | |
| @abstractmethod | |
| def name(self) -> str: | |
| pass |
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
| root@8cfa3f87b3c4:/tbears# git clone https://github.com/cryptoabhi/icx_token | |
| Cloning into 'icx_token'... | |
| remote: Enumerating objects: 13, done. | |
| remote: Counting objects: 100% (13/13), done. | |
| remote: Compressing objects: 100% (9/9), done. | |
| remote: Total 13 (delta 1), reused 10 (delta 1), pack-reused 0 | |
| Unpacking objects: 100% (13/13), done. | |
| root@8cfa3f87b3c4:/tbears# cd icx_token/irc2 | |
| root@8cfa3f87b3c4:/tbears/icx_token/irc2# ls | |
| __init__.py package.json README.md irc2.py tests |
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
| root@8cfa3f87b3c4:/tbears# tbears balance hxe7af5fcfd8dfc67530a01a0e403882687528dfcb | |
| balance in hex: 0x2961fff8ca4a62327800000 | |
| balance in decimal: 800460000000000000000000000 |
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
| $ docker container start -a local-tbears | |
| root@8cfa3f87b3c4:/tbears# |
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
| $ exit | |
| $ docker container ls -a | |
| CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
| 8cfa3f87b3c4 iconloop/tbears "entry.sh" About an hour ago Up 42 minutes 0.0.0.0:9000->9000/tcp local-tbears |
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
| $ docker run -it --name local-tbears -p 9000:9000 iconloop/tbears | |
| ... | |
| ... | |
| Started tbears service successfully |
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
| @app.route('/file', methods=["POST"]) | |
| def upload_file(): | |
| if "user_file" not in request.files: | |
| return "No user_file key in request.files" | |
| file = request.files["user_file"] | |
| if file.filename == "": | |
| return "Please select a file" | |
| # get url from s3 | |
| output = upload_to_aws_s3(file, S3_BUCKET) | |
| return str(output) |
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
| def upload_to_aws_s3(file): | |
| s3.upload_fileobj( | |
| file, | |
| S3_BUCKET, | |
| file.filename, | |
| ExtraArgs={ | |
| "ACL": acl | |
| "ContentType": file.content_type | |
| } | |
| ) |
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
| import boto3 | |
| # AWS Creds | |
| S3_BUCKET = "BUCKET_NAME" | |
| S3_KEY = "BUCKET_ACCESS_KEY" | |
| S3_SECRET = "BUCKET_SECRET_KEY" | |
| # Create boto3 client connection | |
| s3 = boto3.client( | |
| "s3", |
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
| pip3 install boto3 |