Make transaction

POST {{baseUrl}}/protocols/eth/transactions

Send funds to an Ethereum recipient from a given wallet.

Define the sending wallet address via defining a from property in the body and assigning it to a string containing the address of the sending wallet. To define the sending wallet's name instead, assign the from property to an object containing the wallet property with the desired wallet's name. Add the recipient via passing a wallet name of the current vault, any valid to address, or both. If both wallet and address properties are provided in from or to, the API validates if the address resolves to the sending wallet.

POST https://api.tangany.com/custody/protocols/eth/transactions
tangany-network: sepolia

{
  "from": { "wallet": "my-wallet" },
  "to": { 
    "address": "0xc3D5ed2DeE2E5478Ffdb827f164089Ed31572b43", 
    "wallet": "my-other-wallet" 
  },
  "amount": "0.000457"
}

All body properties besides from are optional. Omitting the optional properties will result in a transaction of 0 Ether directed to the from address. A common tactic to cancel underpriced transactions is to replace a pending nonce with a new transaction containing besides the transaction specific properties with a higher fee an empty body.

POST https://api.tangany.com/custody/protocols/eth/transactions

{
  nonce: "44572",
  txSpeed: "fast",
  gasPrice: "30"
}

Invalid transaction configurations are declined with a status 400 response (e.g. insufficient balance).

Call POST /protocols/eth/transactions/estimate to get a fee estimation for desired transaction configurations.

Supports pre-funding of transaction fees via the tangany-use-gas-tank header. Gas Tank is a premium feature available for all demo clients and enrolled subscription customers. Please connect with our sales department to upgrade a subscription.

The endpoint processes the request in a background job and returns a status URI that reports the progress of the asynchronous operation via GET /requests/:request.

Interaction with smart contracts

For a transaction to be interpreted as a smart contract transaction both properties method and inputs need to be set.

The method syntax follows the solidity method signature format with omitted argument names and other keywords such as external view, memory For example:

balanceOf(address) returns (uint256)

transfer(address, address, uint256)

getInvestors(uint256) returns (address[])

```http client POST https://api.tangany.com/custody/protocols/eth/transactions tangany-network: sepolia

{ from: 0x9C2E011c0CE0d75c2B62B9C5A0Ba0a7456593803, to: 0x62f49D4A051a22Cd5573b1197FD3E96F1026346D, method: pause(), inputs: [] } ```

Arguments in the inputs array need to match the order of the function argument types.

```http client POST https://api.tangany.com/custody/protocols/eth/transactions tangany-network: sepolia

{ from: { wallet: my-wallet, address: 0x9C2E011c0CE0d75c2B62B9C5A0Ba0a7456593803 }, to: 0x62f49D4A051a22Cd5573b1197FD3E96F1026346D, method: mint(address,uint256), inputs: [ 0xab174eAb6761d6525A8A3a2E065CA042e74D0025, 1000000000000000000 ] } ```

To use wallet names in the contract body substitute the address type with wallet and pass the wallet name as the input argument.

```http client POST https://api.tangany.com/custody/protocols/eth/transactions tangany-network: mainnet

{ from: { wallet: my-wallet }, to: 0xdac17f958d2ee523a2206206994597c13d831ec7, method: transfer(wallet,uint256), inputs: [ my-wallet, 295000000 ] } ```

The inputs can be passed as native json values:

```http client POST https://api.tangany.com/custody/protocols/eth/transactions tangany-network: mainnet

{ from: { wallet: my-wallet }, to: 0x6412eFCdD4423f166dcF2475770a6764Bbf6bDB2, method: emitMixed(int256, uint256, bool, string, wallet), inputs: [ -100, 295000000, true, example call, my-wallet ] } However the following will result in an error: { from: { wallet: my-wallet }, to: 0x62f49D4A051a22Cd5573b1197FD3E96F1026346D, method: emitUint(uint256), inputs: [ 12000000000000000 // Results in an error ] } Only numbers up to 2^53-1 can be passed as native types. For any big values, we strongly recommend using a string: { from: { wallet: my-wallet }, to: 0x62f49D4A051a22Cd5573b1197FD3E96F1026346D, method: emitUint(uint256), inputs: [ 12000000000000000 ] } ```

You can also pass arrays and fixed size arrays up to five dimensions: http client { "from": { "wallet": "my-wallet" }, "to": "0x62f49D4A051a22Cd5573b1197FD3E96F1026346D", "method": "mapPoints(string[], int8[][], bool[3][2])", "inputs": [ [ "abc" ], [ [1, 0], [0, 1] ], [ [true, true, true], [true, true, true] ] ] } Please be aware that the Solidity argument type for multidimensional arrays employs a reversed nesting notation wherein the implementation of arguments via inputs adheres to the common JSON rules for arrays (see example above)

Tuples (structs) are supported as well:

http client { "from": { "wallet": "my-wallet" }, "to": "0x62f49D4A051a22Cd5573b1197FD3E96F1026346D", "method": "func(uint256, (bool, int256), (int256, bytes)[])", "inputs": [ 1, [ true, -1 ], [ [ -1, "0xFF" ], [ 1, "0xFF" ] ] ] }

Add the optional amount body parameter to pass Ether to payable smart contract methods.

```http client POST https://api.tangany.com/custody/protocols/eth/transactions tangany-network: sepolia

{ from: { wallet: my-wallet }, to: 0x62f49D4A051a22Cd5573b1197FD3E96F1026346D, method: pay(wallet), inputs: [ my-wallet ], amount: 0.0000123 } ```

Responses

Example response body of a Running async request status: json { "status": "Running", "stage": "AwaitingTransactionConfirmation", "created": "2021-09-20T09:17:00Z", "updated": "2021-09-20T09:17:10Z", "output": { "hash": "0x3e84c4accbcfe781105a75a2d51d09d178d4ec1a90bc2cc20a7070ed0df10eab", "nonce": 180828, "gas": "2100", "gasPrice": "2500000000" } }

Example response body of a Complete async request status: json { "status": "Completed", "stage": "transaction confirmed", "created": "2021-09-20T09:17:00Z", "updated": "2021-09-20T09:17:33Z", "output": { "hash": "0x3e84c4accbcfe781105a75a2d51d09d178d4ec1a90bc2cc20a7070ed0df10eab", "nonce": 180828, "blockNr": 11071042, "data": "0x", "status": "confirmed", "gas": "2100", "gasPrice": "2500000000" } }

Request Body

{"from"=>{"wallet"=>"{{wallet}}"}, "to"=>{"wallet"=>"my-other-wallet"}, "amount"=>"0.000457"}

HEADERS

KeyDatatypeRequiredDescription
tangany-versionnumber(Required) Default header that directs the request towards desired Tangany Custody Api version (e.g 2 directs to Tangany Custody APi v2).

Supports only major versions. | | tangany-network | string | | (Optional header) Define an API-supported public Ethereum network or a custom external Ethereum RPC endpoint to operate in.

Accepts supported public network enums and custom Ethereum RPC URLs. Defaults to mainnet when omitted from the call.

Supported public networks: mainnet, goerli, sepolia, polygon, mumbai, bsc, bsc-testnet, gnosis, and chiado.

Examples for private Ethereum RPC: https://somenetwork.example.org:8540?mykey. External RPCs must be whitelisted by the Tangany support in order to be used in the API.

Example: sepolia | | tangany-tx-confirmations | number | | (Optional header) Defines a secure amount of block confirmations required to consider an Ethereum transaction as valid.

Accepts positive integers. Defaults to 1.

Ethereum transactions are usually considered final after 12 network confirmations. | | tangany-use-gas-tank | boolean | | (Optional header) Allows to pre-fund the transaction fee of a transaction.

Accepts boolean values. Defaults to false.

One possible use case for pre-funding of the transaction fees is to enable wallets to interact with smart contracts on public networks (e.g. trading tokens) without requiring wallet Ether balance ("Ether-less" wallet principle)

This feature is enabled on a subscription basis.

Example: true | | tangany-request-id | string | | (Optional header) A client provided request ID / idempotency key for the asynchronous transaction

When present, the asynchronous transaction will be identified by the provided ID.

The API rejects all but the first request with a given request ID. This way, you can make sure that a given action (e.g. a transaction) will be executed only once.

A client-generated ID can also be used to deterministically recover a missed API response, for example in the event of a gateway timeout or loss of connection.

The API responds with a 409 Conflict status when a given ID has already been used. See GET /requests/:request for more information.

The value must be between 1 and 36 characters and contain only alphanumeric characters or dashes.

Defaults to a randomly generated value when omitted. | | Content-Type | string | | | | Accept | string | | |