Invoke Lambda

The API invokes a lambda(smart contract) on Solana without any gas for both you and your users. The API also supports external signers if the transaction needs to be signed by someone other than the user. If you would like, you can also cover the rent costs for your users.

Here are some sample requests:

{
  "serializedTransactionMessage": "0x040001051d6a53......",
  "description": {
    "text": "mint an NFT"
  }
}
{
  "serializedTransactionMessage": "0x040001051d6a53......",
  "as": {
    "email": "[email protected]"
  },
  "description": {
    "text": "mint an NFT",
    "image": "https://valid_image_url......"
  }
}
{
  "signatures": [
    {
      "publicKey": "2k1ZTti7uQ1BZyMTscVLbzm3H74ncv2JdtLTio3FQxpb",
      "signature": "0x35068ad4b9a199a896a....."
    },
    {
      "publicKey": "HLETGSnF62q7ANP8SoWe7sxq7qrG3CEH6rJJhjaPadn8",
      "signature": "0xd2ac1cb04ae940388e73...."
    }
  ],
  "serializedTransactionMessage": "0x040001051d6a53......",
  "description": {
    "text": "mint an NFT"
  }
}

šŸ‘

Solana versioned transactions are supported

You can find end-to-end working code samples here .

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 ensure 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 ensure transactions succeed, and at the lowest cost.

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

Fee Payer

The fee payer should be set to the sponsor's address before calling the API. The API will fail with an INVALID_SPONSOR error if the fee payer is not the sponsor's address.

Latest Blockhash

If there are no external signers, you can set the latest blockhash to any value. To improve the success rate of the transaction, the API will automatically fetch the latest blockhash and use it to sign and broadcast the transaction.

If there are external signers, you should set the latest blockhash by fetching it from a Solana node before calling the API. The API cannot update the latest blockhash if there are external signers.

Priority Fee(aka Compute Price)

If you want to use the priority fee, please include the compute price instruction in the message.

If there are no external signers, you can set the compute price to any value. The lambda will automatically reprice the transaction if needed based on the current Solana network conditions.

If there are external signers, you will have to set the compute price yourself by fetching it from a Solana node before calling the API. The API cannot update the compute price if there are external signers.

There is a limit to the compute price that can be provided. The maximum compute price that can be set currently is 1000000(1 million). The API will fail with a PRIORITY_FEE_TOO_HIGH error if the compute price exceeds this limit. We also recommend setting the compute budget too to avoid unnecessary fee charges.

Rent Payment

Please reach out to us if you need rent payment enabled for your app :)

Error Status

šŸš§

Api Error Status

You can find error status returned by the api here.

Ā© Copyright 2024, Passbird Research Inc.

Language
Credentials
Header
Click Try It! to start a request and see the response here!