Marmo Documentation

Marmo Documentation

  • Home
  • Docs
  • Github

›Api reference

Getting Started

  • What is Marmo?
  • Install
  • Wallets
  • Intents and Transactions

Api reference

  • Configuration reference
  • Provider reference
  • Wallet reference
  • Intent action reference
  • Intent reference
  • Signed Intent reference
Edit

Intent action reference

Intent actions are abstract representations of transactions, are meant to avoid manually constructing the "to, data and value" of a standard Ethereum transaction.

Contract

If the Intent is meant to interact with a contract, the process to create this intent involves defining a contract interface.

Standard contracts

The Marmo SDKs come with the most common contract interface already pre-defined. It includes ETH, ERC20, ERC721, and some others.

Python
JavaScript
Java
from marmopy import ETH, ERC20
import { ETH, ERC20 } from "marmojs";
todo

Custom contract interface

To create an Intent calling a contract that uses a custom interface, it is required to specify such interface to the Marmo SDK

Python
JavaScript
Java
from marmopy import Action

class MyContract:
def __init__(self, address):
self.address = address

@Action
def setOwner(self, owner='address'): return 'bool'

my_contract = MyContract("<contract address>")

# Create setOwner intent action
my_contract.setOwner("<new owner>")

Using the contract ABI

from marmopy import Contract

abi = """
[
{
"constant": false,
"inputs": [
{
"name": "owner",
"type": "address"
}
],
"name": "setOwner",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]
"""


MyContract = Contract(abi)
my_contract = MyContract("<contract address>")

# Create setOwner intent action
my_contract.setOwner("<new owner>")
todo
todo

Create intent action

Before interacting with a Contract, it is required to instantiate it with the address of the contract on the blockchain, after creating the instance, all methods of the contract can be called, and they will return an intent action.

Python
JavaScript
Java
from marmopy import ERC20

dai_token = ERC20("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359")

# Create intent action transfer 1 DAI
intent_action = dai_token.transfer("<destination>", 10 ** 18)
import { ETH, ERC20 } from "marmojs";
todo

Intent action send Ether

Sending Ethereum is a special kind of intent action, because it does not require to instantiate any contract.

Python
JavaScript
Java
from marmopy import ETH

# Create intent action transfer 5 ETH
intent_action = ETH.transfer("<destination>", 10 ** 18)
import { ETH, ERC20 } from "marmojs";
todo
Last updated on 2019-2-26 by Agustin Aguilar
← Wallet referenceIntent reference →
  • Contract
    • Standard contracts
    • Custom contract interface
  • Create intent action
    • Intent action send Ether
Marmo Documentation
Docs
Getting StartedCreate WalletsIntents and transactions
Community
HomeProject chat
More
GitHubStar
Copyright © 2019 Ripio Credit Network - Docs powered by Docusaurus