Skip to main content

Python library to create and submit Ethereum transactions to custodians connected with MetaMask Institutional; the most trusted DeFi wallet and Web3 gateway for organizations.

Project description

MetaMask Institutional SDK (Beta)

A Python library to create and submit Ethereum transactions to custodians connected with MetaMask Institutional; the most trusted DeFi wallet and Web3 gateway for organizations.

BETA DISCLAIMER. By using this library, you acknowledge the technology is still in Beta access and for internal testing purposes only. You are responsible for your use of the Beta access to Open Source SDK and ConsenSys is not responsible for any bugs, deficiencies or issues that may occur.

Banner

Usage

Use this SDK to programmatically create Ethereum transactions, and submit them to custodians connected with MetaMask Institutional. Automate trading strategies on your wallets under custody, and still benefit from the institutional-grade security of your favorite qualified custodian and custody provider.

Getting started

Setting up

$ pip install mmisdk
>>> from mmisdk import CustodianFactory

>>> factory = CustodianFactory()

>>> custodian = factory.create_for("qredo", "YOUR-TOKEN")

Use the custodian's Factory name param in the table below to instantiate a client for the right custodian.

Custodian Supported As of version Factory name param
Bitgo 0.3.0 "bitgo"
Bitgo Test 0.3.0 "bitgo-test"
Cactus 0.2.0 "cactus"
Cactus Dev 0.2.0 "cactus-dev"
FPG 0.4.0 "fpg-prod"
FPG Alpha 0.4.0 "fpg-alpha"
FPG Local 0.4.0 "fpg-local"
Gnosis Safe 0.4.0 "gnosis-safe"
Gnosis Safe Dev 0.4.0 "gnosis-safe-dev"
Gnosis Safe Staging 0.4.0 "gnosis-safe-staging"
Qredo 0.2.0 "qredo"
Qredo Dev 0.1.0 "qredo-dev"
Saturn 0.4.0 "saturn"
Saturn Dev 0.4.0 "saturn-dev"

Creating a transaction

import os

from mmisdk import CustodianFactory

# Instantiate the factory
factory = CustodianFactory()

# Grab your token from the environment, or anywhere else
token = os.environ["MMISDK_TOKEN_QREDO_DEV"]

# Create the custodian, using the factory
custodian = factory.create_for("qredo-dev", token)

# Build tx details
tx_params = {
    "from": "0x62468FD916bF27A3b76d3de2e5280e53078e13E1",
    "to": "0x62468FD916bF27A3b76d3de2e5280e53078e13E1",
    "value": "100000000000000000",  # in Wei
    "gas": "21000",
    "gasPrice": "1000",
    # "data": "0xsomething",
    # "type": "2"
    # "maxPriorityFeePerGas": "12321321",
    # "maxFeePerGas": "12321321",
}
qredo_extra_params = {
    "chainID": "3",
}

# Create the tx from details and send it to the custodian
transaction = custodian.create_transaction(tx_params, qredo_extra_params)
print(type(transaction))
# <class 'mmisdk.common.transaction.Transaction'>

print(transaction)
# id='2EzDJkLVIjmH6LZQ2W1T4wPcTtK'
# type='1'
# from_='0x62468FD916bF27A3b76d3de2e5280e53078e13E1'
# to='0x62468FD916bF27A3b76d3de2e5280e53078e13E1'
# value='100000000000000000'
# gas='21000'
# gasPrice='1000'
# maxPriorityFeePerGas=None
# maxFeePerGas=None
# nonce='0'
# data=''
# hash=''
# status=TransactionStatus(finished=False, submitted=False, signed=False, success=False, displayText='Created', reason='Unknown')

Getting a transaction

import os

from mmisdk import CustodianFactory

# Instantiate the factory
factory = CustodianFactory()

# Grab your token from the environment, or anywhere else
token = os.environ["MMISDK_TOKEN_CACTUS_DEV"]

# Create the custodian, using the factory
custodian = factory.create_for("cactus-dev", token)

# Get the transaction
transaction = custodian.get_transaction("5CM05NCLMRD888888000800", 5)

print(type(transaction))
# <class 'mmisdk.common.transaction.Transaction'>

print(transaction)
# id='5CM05NCLMRD888888000800'
# type='1'
# from_='0xFA42B2eCf59abD6d6BD4BF07021D870E2FC0eF20'
# to=None
# value=None
# gas='133997'
# gasPrice='2151'
# maxPriorityFeePerGas=None
# maxFeePerGas=None
# nonce=''
# data=None
# hash=None
# status=TransactionStatus(finished=False, submitted=False, signed=False, success=False, displayText='Created', reason='Unknown')

Examples

Continue on the page Examples to see all code examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mmisdk-0.4.4.tar.gz (230.0 kB view details)

Uploaded Source

Built Distribution

mmisdk-0.4.4-py3-none-any.whl (56.0 kB view details)

Uploaded Python 3

File details

Details for the file mmisdk-0.4.4.tar.gz.

File metadata

  • Download URL: mmisdk-0.4.4.tar.gz
  • Upload date:
  • Size: 230.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for mmisdk-0.4.4.tar.gz
Algorithm Hash digest
SHA256 45fb8450e8bd1d491a00cc362e563d19c16a25e135f3556a81b46601ac913add
MD5 ad7ad1308b1a7c6bc380c8c93085bf24
BLAKE2b-256 c12616f940930a157ae4334d362973014aec96e5290da290643ed769839acc15

See more details on using hashes here.

File details

Details for the file mmisdk-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: mmisdk-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 56.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for mmisdk-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 97cee0fc3fb3351aa4ca118e546d0d3a1acc33989bc590d66f7824b56cc41bb0
MD5 a6c948b4053a92cef560b0a037378143
BLAKE2b-256 3427ba8ce7d7518af1a6852e469f1157f42bc5863892c043904b28b13eb5970a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page