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
as
userIf 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 asQUEUED
, replaying this API doesn't give you the latest status; Replaying the same API with the sameIdempotency-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
as
userIf 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.