11---
2- title : Run iApp with ProtectedData
2+ title : Run iApp
33description :
44 Learn how to run iApp with encrypted protected data, arguments, and input
5- files using the DataProtector toolkit for secure data processing
5+ files using the iApp Generator toolkit
66---
77
8- # 📥 Run iApp with a ProtectedData
8+ # 📥 Run iApp
99
1010When running an iApp, you can use multiple types of inputs. While ProtectedData
1111is not mandatory to run an iApp, it's a powerful input type that allows you to
@@ -14,39 +14,51 @@ inputs that come directly from you (the requester) and can change between each
1414execution: Arguments, Input Files, and Secrets. These non-persistent inputs are
1515perfect for customizing the iApp's behavior for each specific run.
1616
17+ ``` ts twoslash
18+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp' ;
19+
20+ const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
21+ const iappGenerator = new IExecIApp (web3Provider );
22+ // ---cut---
23+ // Process protected data with specific path
24+ const result = await iappGenerator .runIApp ({
25+ iapp: ' 0x456def...' ,
26+ });
27+ ```
28+
1729## Adding Protected Data
1830
1931When working with protected data that contains multiple files, you can specify
2032which file to process.
2133
2234``` ts twoslash
23- import { IExecDataProtectorCore , getWeb3Provider } from ' @iexec/dataprotector ' ;
35+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp ' ;
2436
2537const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
26- const dataProtectorCore = new IExecDataProtectorCore (web3Provider );
38+ const iappGenerator = new IExecIApp (web3Provider );
2739// ---cut---
2840// Process protected data with specific path
29- const result = await dataProtectorCore .processProtectedData ({
41+ const result = await iappGenerator .runIApp ({
42+ iapp: ' 0x456def...' ,
3043 protectedData: ' 0x123abc...' ,
31- app: ' 0x456def...' ,
3244 path: ' data/input.csv' ,
3345});
3446```
3547
36- The ` processProtectedData ` function will automatically download and decrypt the
48+ The ` runIApp ` function will automatically download and decrypt the
3749results for you. Nevertheless, if you want to retrieve results from a completed
3850task, you can do so as follows:
3951
4052``` ts twoslash
41- import { IExecDataProtectorCore , getWeb3Provider } from ' @iexec/dataprotector ' ;
53+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp ' ;
4254
4355const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
44- const dataProtectorCore = new IExecDataProtectorCore (web3Provider );
56+ const iappGenerator = new IExecIApp (web3Provider );
4557const taskId = ' 0x7ac398...' ;
4658
4759// ---cut---
4860// Retrieve the result
49- const taskResult = await dataProtectorCore .getResultFromCompletedTask ({
61+ const taskResult = await iappGenerator .getResultFromCompletedTask ({
5062 taskId: taskId ,
5163});
5264```
@@ -57,15 +69,15 @@ Command-line arguments are passed as a string to the iApp and are visible on the
5769blockchain.
5870
5971``` ts twoslash
60- import { IExecDataProtectorCore , getWeb3Provider } from ' @iexec/dataprotector ' ;
72+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp ' ;
6173
6274const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
63- const dataProtectorCore = new IExecDataProtectorCore (web3Provider );
75+ const iappGenerator = new IExecIApp (web3Provider );
6476// ---cut---
6577// Process protected data with arguments
66- const result = await dataProtectorCore .processProtectedData ({
78+ const result = await iappGenerator .runIApp ({
79+ iapp: ' 0x456def...' ,
6780 protectedData: ' 0x123abc...' ,
68- app: ' 0x456def...' ,
6981 args: ' --input-path data/input.csv --output-format json --verbose' ,
7082});
7183```
@@ -76,15 +88,15 @@ Input files are URLs to public files that the iApp can download during
7688execution.
7789
7890``` ts twoslash
79- import { IExecDataProtectorCore , getWeb3Provider } from ' @iexec/dataprotector ' ;
91+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp ' ;
8092
8193const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
82- const dataProtectorCore = new IExecDataProtectorCore (web3Provider );
94+ const iappGenerator = new IExecIApp (web3Provider );
8395// ---cut---
8496// Process protected data with input files
85- const result = await dataProtectorCore .processProtectedData ({
97+ const result = await iappGenerator .runIApp ({
98+ iapp: ' 0x456def...' ,
8699 protectedData: ' 0x123abc...' ,
87- app: ' 0x456def...' ,
88100 inputFiles: [
89101 ' https://raw.githubusercontent.com/user/repo/main/config.json' ,
90102 ' https://example.com/public-data.csv' ,
@@ -98,15 +110,15 @@ Secrets are sensitive data like API keys, passwords, or tokens that are stored
98110securely and made available to the iApp as environment variables.
99111
100112``` ts twoslash
101- import { IExecDataProtectorCore , getWeb3Provider } from ' @iexec/dataprotector ' ;
113+ import { IExecIApp , getWeb3Provider } from ' @mage-sombre/iapp ' ;
102114
103115const web3Provider = getWeb3Provider (' PRIVATE_KEY' );
104- const dataProtectorCore = new IExecDataProtectorCore (web3Provider );
116+ const iappGenerator = new IExecIApp (web3Provider );
105117// ---cut---
106118// Process protected data with secrets
107- const result = await dataProtectorCore .processProtectedData ({
119+ const result = await iappGenerator .runIApp ({
120+ iapp: ' 0x456def...' ,
108121 protectedData: ' 0x123abc...' ,
109- app: ' 0x456def...' ,
110122 secrets: {
111123 1 : ' openai-api-key' ,
112124 2 : ' database-password' ,
0 commit comments