def read_secret(self, sess):
        k = Key.from_encoded_key(sess['secret'], passphrase=sess['password'])
        p = pytezos.using(key=k, shell=sess['network'])

        print(k.public_key_hash())

        return p
Example #2
0
import os.path
import requests
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials

# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']

# The ID and range of a sample spreadsheet.
FOUNTAIN_SPREADSHEET_ID = '1fcMoCMw44mZvA2qR84Bdxfi90b0AEfINflPdiBqU3kg'
FOUNTAIN_RANGE_NAME = 'Form Responses 1!A2:I'

# Address: tz1UqhPnVXdPccrVsa5khscwCLHTF2Q2CAer
key = Key.from_encoded_key(os.environ['TEIA_FOUNTAIN_KEY'],
                           os.environ['TEIA_FOUNTAIN_PASS'])
pytezos = pytezos.using(shell='mainnet', key=key)
acct_id = pytezos.key.public_key_hash()
acct = pytezos.account()


def get_genesis(acct_id):
    url = f'https://api.tzkt.io/v1/bigmaps/522/keys?sort.asc=id&value.issuer={acct_id}&limit=1'
    r = requests.get(url)
    if r.status_code != 200:
        time.sleep(1)
        return get_genesis(acct_id)
    data = r.json()
    if len(data) > 0:
        return data[0]['key']
    return ''
Example #3
0
        blocks = self.client.shell.blocks[-self.block_depth:]
        try:
            res = blocks.find_operation(op_hash)
            if not OperationResult.is_applied(res):
                raise RpcError.from_errors(
                    OperationResult.errors(res)) from op_hash
            print(pformat_consumed_gas(res))
            return res
        except StopIteration:
            # not found
            return None


flextesa_sandbox = pytezos.using(
    shell="http://localhost:20000",
    key=Key.from_encoded_key(
        "edsk3RFgDiCt7tWB2oe96w1eRw72iYiiqZPLu9nnEY23MYRp2d8Kkx"),
)


def token_metadata_literal(token_id, symbol, name, decimals):
    bsymbol = symbol.encode().hex()
    bname = name.encode().hex()
    bdecimals = str(decimals).encode().hex()
    return """{
        token_id = %sn;
        token_info = Map.literal [
          ("symbol", 0x%s);
          ("name", 0x%s);
          ("decimals", 0x%s);
        ];
    }
Example #4
0
 def load_keystore(self):
     k = Key.from_encoded_key(os.getenv('TZ_SK_DEPLHI'),
                              passphrase=os.getenv('TZ_PASS_DELPHI'))
     return pytezos.using(key=k, shell=os.getenv('TZ_NETWORK'))