Learn how to use our product with this module.
Allows for direct interactions with a blockchain smart contract method without requiring user inputs.
BLOCKCHAIN_TRADER
Each instance of this module can interact with a single method on a smart contract. Create multiple instances and assign them to questions if you wish to have multiple interactions (such as "buy", "sell", "balance", etc.).
The blockchain trader module is best used in coordination with a module that can forward data into it, such as the questionnaire module. This will allow the data from the questionnaire to be used to make informed decisions as to how the interaction should take place.
At present time, value-based transactions only support ERC-20 tokens, with native currencies not availale for transfers.
Setting Key | Type | Default Value | Description |
---|---|---|---|
msg |
string |
Welcome to the Trader Module, please connect your wallet to continue. | Message shown to user when the module loads. |
msgComplete |
string |
Your wallet has been connected! Let's start trading! | Message shown to user when their wallet has been connected. |
network |
string |
LINEA | Any valid and supported blockchain network. See list of supported networks for details. |
contractAddress |
string |
- | The address of your contract. |
currency |
string |
- | The ERC-20 token currency your contract transacts in. See list of supported currencies. Native currencies are not supported. |
isTestnet |
boolean |
true | Whether to use testnet or not. If not using testnets, you will have to supply your own production-ready Web3Auth and Infura keys. |
web3AuthClientId |
string |
- | Required for non-testnet interactions. |
infuraProjectId |
string |
- | Required for non-testnet interactions. |
sendToAiAgent |
boolean |
true | Whether you want to send a prompt to the AI agent requesting how the user should trade when the module loads. If using this, make sure the "purpose" setting gives clear directions to the AI agent to provide a suggested trade and make sure that the dataset's data contains the information the bot needs to make the trade, such as the outcomes. We recommend using this in coordination with another module such as the questionnaire so that the AI agent can make a better assessment for the user. |
method |
IMethodSignature |
- | The method signature to call on the smart contract. Parameters must match the order of the contract's ABI. |
minTradingValue |
number |
0 | The minimum amount a user can trade with. Please see "Trading Value" for more details. |
maxTradingValue |
number |
0 | The maximum amount a user can trade with. Please see "Trading Value" for more details. |
tradingSteps |
number |
3 | Gives monetary options the user can select from. Please see "Trading Value" for more details. |
purpose |
string |
I want you to suggest a trade that I should make based on what you know about me and this dataset. I'm willing to wager up to %balance% %currency%. Please explain why you are suggesting it. | The instructions given to the AI model behind the scenes instructing it what to do. We recommend that you compose this in first-person, as if the user is speaking directly to the AI. %balance% will be replaced with the user's token balance. %currency% will be replaced with the token symbol. |
actionLabel |
string |
Execute Transaction | The call to action to execute the transaction. |
msgSuccess |
string |
Your transaction was successful: %data% | Chat shown to user after a TX is completed. %data% will be replaced with a link to the block explorer TX. |
{
"method": "myMethod",
"type": "transaction",
"parameters": [
{
"name": "inputOne",
"type": "string",
"description": "Whatever this input's purpose is.",
"forceValue": ""
},
{
"name": "inputTwo",
"type": "uint",
"description": "Whatever this input's purpose is.",
"forceValue": "0x0",
"isToken": true
}
]
}
function myMethod(string memory inputOne, uint inputTwo) public {
...
}
Key | Type | Default Value | Description |
---|---|---|---|
method |
string |
- | |
type |
transaction | read |
- | Set to transaction for state-changing calls, or read for view calls. |
parameters |
IParameter[] |
- |
Key | Type | Default Value | Description |
---|---|---|---|
name |
string |
- | The name of the function parameter input. |
type |
string |
- | Any valid Solidity smart contract typing. |
description |
string |
- | A description of what this input parameter is. |
forceValue |
string|null |
null | If you want to force a value for this output, input it here. Set to null to have AI determine the value. |
isToken |
boolean |
false | Whether this represents a token transfer value. |
How much the user is willing to trade in a transaction is determined by a number of factors, those being:
maxTradingValue
, minTraderValue
, and tradingSteps
settings.forceValue
parameter of the IParameter.isToken
value.maxTradingValue
and minTraderValue
are both set to 0
, the IParameter.isToken.forceValue
will be used as the trading value. However, if IParameter.isToken.forceValue
is set to null
or 0
, the trading value will be the user’s wallet balance.maxTradingValue
and minTraderValue
are both set to greater than 0
but equal, that value will be the amount of the transaction.maxTradingValue
and minTraderValue
are greater than 0
but not equal, the traderSteps
settings will be used to give the user options to select from (see “Scenarios With User-Selected Values” section below)maxTradingValue
by the tradingSteps
.minTradingValue
is always added at the start of the list, so if you have 5 trading steps, the system will actually display 6.