Invoke Lambda

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

After the lambda is created from the /v2/app/lambda/create API call or imported using the /v2/app/lambda/import API, use this API to execute a lambda(smart contract) function.

Here are some sample requests:

{
  "lambda": "0x94f943354dB6710da3010bA4F9646402DEC1C73c",
  "function": {
    "name": "mint",
    "args": [
      "123"
    ]
  },
  "description": {
    "text": "mint an NFT"
  }
}
{
  "lambda": "0x94f943354dB6710da3010bA4F9646402DEC1C73c",
  "function": {
    "name": "mint",
    "args": [
      "123"
    ]
  },
  "as": {
    "email": "[email protected]"
  },
  "description": {
    "text": "mint an NFT",
    "image": "https://valid_image_url......"
  }
}
{
  "lambda": "0x94f943354dB6710da3010bA4F9646402DEC1C73c",
  "function": {
    "name": "mint",
    "args": [
      "123"
    ]
  },
  "pay": "0.3",
  "as": {
    "email": "[email protected]"
  },
  "description": {
    "text": "mint an NFT"
  }
}

Invoking without as user

If you don't provide an as user in the request body, lambda will be invoked from your developer account and a transaction will be raised and submitted to the Queue on the blockchain. MetaKeep, behind the scenes, employs several strategies to make sure transactions succeed, and at the lowest cost.

You can get the status of this blockchain transaction by querying for transaction status by copying the transactionId from this API response and querying it in Transaction Status API.

❗️

Replaying this API

Once you get a status response as QUEUED, replaying this API doesn't give you the latest status; Replaying the same API with the same Idempotency-Key results in the same response, always with status-QUEUED. You must query the Transaction Status API for the latest status.

As you would learn from the Transaction Status API docs, if a transaction failed, MetaKeep would have exhausted all feasible smart AI-based strategies to recover from failure, that would have been attempted by humans, and the "FAILED" status, if shown, is final.

Invoking with as user

If you provide an as user in the request body, you will get a consentToken back and you will have to use Get Consent flow to finish the lambda invocation. Here, the developer is agreeing to pick up the gas fee on execution so that the user doesn't have to know/understand the concept of gas. MetaKeep, behind the scenes, employs several strategies to make sure transactions succeed, and at the lowest cost.

{
  "status": "USER_CONSENT_NEEDED",
  "consentToken": "CrgBAQIDAHgtrXLM7Takfd-ccn6FAthYppUrIuoEMsncIpxm4af4uUh4Cikr2YkEzasNQr9433Z-V73Hw=="
}

Payment (aka Value Transfer)

You can send an optional payment(value) to a payable lambda function using the pay parameter. This is useful if you want to pay the lambda function for performing some operation. For example, if you want to pay the lambda function for minting an NFT, you can use the pay parameter to send the payment to the lambda function.

📘

Note that the payment is only supported when using BUSINESS_WALLET

Gas Limit

This API currently has gas limit set to 2000000(2M). If you need a higher gas limit, please let us know.

Gas Price

The API sets the right gas price for the transaction based on AI and statistical analysis of the current network conditions for fast and reliable transaction confirmation. If you want even faster confirmation, you can tune the transaction speed in the app settings.

Error Status

🚧

Api Error Status

You can find error status returned by the api here.

© Copyright 2024, Passbird Research Inc.

Body Params
string
required

Hex encoded lambda address. This is obtained from a previous /v2/app/lambda/create or /v2/app/lambda/import API call

function
object
required

Lambda Function to invoke with arguments in the format { name: "function_name", args: [] }.

string

How much native currency(e.g. MATIC on Polygon) to pay(aka value transfer) to the payable lambda function. This should be a decimal string with up to 18 decimals. Only supported when using BUSINESS_WALLET

description
object
required

The human understandable explanation for this transaction. Useful for presenting to the user as an extra information ex: Swap wBTC to USDC, and for auditing purposes. The description should include a text and an optional image.

as
object

Invoke lambda as this user. If this is not set, lambda will be invoked from your developer account.

string
enum

The lambda wallet type to use for the transaction. This can be either be empty or BUSINESS_WALLET.

Allowed:
Headers
string
required

An idempotency key is a unique value generated by the client which the server uses to recognize subsequent retries of the same request. This allows developers to safely retry requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. Read more

Response

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json