Scenario
Scenario Address | It is aslo a PIRI Address
OK
POST /getScenario HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 18
"address='text'"OK
{
"error": 0,
"data": {
"countOfExecution": 170,
"_id": "64d7a7b5599032859f7ab571",
"address": "PRTMPKQF8LJMEYgn3KcnW6CcHYnZ4q2whLFDfgg4pX4",
"ownerAddress": "PRTMRKWZ56v4D8mV1oj813bqTgdfUm9J4woVTDMpGxF",
"name": "final deposit and withdraw swap scenario",
"description": "final deposit and withdraw swap scenario",
"tags": "final deposit and withdraw swap scenario",
"createdDate": "2023-08-12T15:39:33.321Z",
"validated": 0,
"scenarioText": "//####PIRICHAIN Smart Scenario v.1.0########\n// PiriChain Smart Scenario Code Blocks Area \n\n // All Functions must be return promise non-blocking async block or await prefix delimitier.. \n\nasync function depositLiqudity(ratio)\n{....",
"__v": 0
},
"byteCode": "002f002..."
}Owner PIRI Address
Private Key
To Execution Restriction by Owner
falseScenario Codes in Javascript | Typescript
Scenario name
Scenario description
Scenario Tags
OK
Number of times this scenario has been executed.
Unique database identifier for the created scenario.
The blockchain address assigned to this scenario.
The PIRI address of the scenario owner/creator.
The name given to the scenario.
Description of what the scenario does.
Tags associated with the scenario for categorization.
ISO 8601 timestamp when the scenario was created.
Validation status of the scenario. 0 = not validated, 1 = validated.
The actual scenario code (JavaScript/TypeScript) that was submitted.
Version key used by MongoDB for document versioning.
POST /createScenario HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 133
"address='text'&privateKey='text'&executeOnlyByMe=false&scenarioText='text'&name='text'&description='text'&tags='text'"OK
{
"countOfExecution": 0,
"_id": "12345678901234567890abcd",
"address": "PRTMExampleScenarioAddress1234567890",
"ownerAddress": "PRTMExampleOwnerAddress1234567890abcd",
"name": "Example Scenario",
"description": "This is an example scenario description.",
"tags": "['Example', 'Demo', 'Test']",
"createdDate": "2024-08-22T10:00:00.000Z",
"validated": 0,
"scenarioText": "async function init(param1, param2, param3) { return 'example'; }",
"__v": 0
}PIRI Address where scenarios will be listed
OK
POST /listMyScenarios HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 23
"ownerAddress='text'"OK
{
"error": 0,
"data": [
{
"countOfExecution": 0,
"_id": "632b10e81ca0c3ae24ebe5b7",
"address": "PRTMPGC6pVU8sZFWK9CS5ZrnCzCBUfDEdrPfYMKoRAS",
"ownerAddress": "PRTMR5pDravSYmAdohUNSoGoEgwyEg2mG8xbWuAfb47",
"name": "Test",
"description": "This is test description.",
"tags": "['Business', 'Development', 'Schedule', 'RSS Feed', 'Lab Study']",
"createdDate": "2022-09-21T13:26:00.454Z",
"validated": 0,
"scenarioText": "002f002f002...",
"__v": 0
}
]
}Number of records to skip for pagination
Maximum number of records to return
OK
POST /listScenarios HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 20
"skip=1&limit=1"OK
{
"error": 0,
"data": [
{
"countOfExecution": 0,
"_id": "632b10e81ca0c3ae24ebe5b7",
"address": "PRTMPGC6pVU8sZFWK9CS5ZrnCzCBUfDEdrPfYMKoRAS",
"ownerAddress": "PRTMR5pDravSYmAdohUNSoGoEgwyEg2mG8xbWuAfb47",
"name": "Test",
"description": "This is test description.",
"tags": "['Business', 'Development', 'Schedule', 'RSS Feed', 'Lab Study']",
"createdDate": "2022-09-21T13:26:00.454Z",
"validated": 0,
"scenarioText": "002f002f00230...",
"__v": 0
}
],
"count": 1
}The address of the scenario to call
Public key of the caller
Address of the caller
Method name to call in the scenario
Parameters to pass to the method
OK
Error status code. 0 indicates success, non-zero indicates an error.
POST /callScenario HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 94
"scenarioAddress='text'&publicKey='text'&address='text'&method='text'¶ms='text'"OK
{
"error": 0,
"data": {
"result": "success",
"gasUsed": 1500,
"executionTime": 25
}
}Scenario Address | It is aslo a PIRI Address
Executer PIRI Address
Private Key
The method to be run in the scenario
Parameters | e.g.: ["value1", "value2", ...]
Amount to send Token to Scenario Address
Asset ID to send Token to Scenario Address
OK
Error status code. 0 indicates success, non-zero indicates an error.
POST /executeScenario HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 125
"scenarioAddress='text'&address='text'&privateKey='text'&method='text'¶ms=['text']&amount=1&assetID='text'"OK
{
"error": 0,
"returnedData": [
"Example Result"
]
}Scenario Text | Javascript or Typescript Code
Executer PIRI Address
Private Key
The method to be run in the scenario
Parameters | e.g.: ["value1", "value2", ...]
OK
Error code (0 for success)
Returned data from scenario execution - can be any type
POST /previewScenario HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 94
"scenarioText='text'&address='text'&privateKey='text'&method='text'¶ms=['text']"OK
{
"error": 0,
"returnedData": [
"AHMET"
]
}Last updated