iexec / IExecAppModule
module exposing app methods
new IExecAppModule(
configOrArgs,options?):IExecAppModule
Create an IExecModule instance
IExecAppModule
config:
IExecConfig
current IExecConfig
checkAppSecretExists(
appAddress,options?):Promise<boolean>
check if a secret exists for the app in the Secret Management Service
example:
const isSecretSet = await checkAppSecretExists(appAddress);
console.log('app secret set:', isSecretSet);NB:
- each TEE framework comes with a distinct Secret Management Service, if not specified the TEE framework is inferred from the app
string
Promise<boolean>
checkDeployedApp(
appAddress):Promise<Boolean>
check if an app is deployed at a given address
example:
const isDeployed = await checkDeployedApp(address);
console.log('app deployed', isDeployed);string
Promise<Boolean>
countUserApps(
userAddress):Promise<BN>
count the apps owned by an address.
example:
const count = await countUserApps(userAddress);
console.log('app count:', count);string
Promise<BN>
deployApp(
app):Promise<{address:string;txHash:string; }>
SIGNER REQUIRED
deploy an app contract on the blockchain
example:
const { address } = await deployApp({
owner: address,
name: 'My app',
type: 'DOCKER',
multiaddr: 'registry.hub.docker.com/iexechub/vanityeth:1.1.1',
checksum: '0x00f51494d7a42a3c1c43464d9f09e06b2a99968e3b978f6cd11ab3410b7bcd14',
});
console.log('deployed at', address);Promise<{ address: string; txHash: string; }>
predictAppAddress(
app):Promise<string>
predict the app contract address given the app deployment arguments
example:
const address = await predictAppAddress({
owner: address,
name: 'My app',
type: 'DOCKER',
multiaddr: 'registry.hub.docker.com/iexechub/vanityeth:1.1.1',
checksum: '0x00f51494d7a42a3c1c43464d9f09e06b2a99968e3b978f6cd11ab3410b7bcd14',
});
console.log('address', address);Promise<string>
pushAppSecret(
appAddress,secretValue,options?):Promise<boolean>
SIGNER REQUIRED, ONLY APP OWNER
push an application secret to the Secret Management Service
NB:
- pushed secret will be available for the app in
teetasks. - once pushed a secret can not be updated
- each TEE framework comes with a distinct Secret Management Service, if not specified the TEE framework is inferred from the app
example:
const isPushed = await pushAppSecret(appAddress, "passw0rd");
console.log('pushed App secret:', isPushed);string
String
Promise<boolean>
showApp(
appAddress):Promise<{app:App;objAddress:string; }>
show a deployed app details
example:
const { app } = await showApp('0xb9b56f1c78f39504263835342e7affe96536d1ea');
console.log('app:', app);string
Promise<{ app: App; objAddress: string; }>
showUserApp(
index,address):Promise<{app:App;objAddress:string; }>
show deployed app details by index for specified user user
example:
const { app } = await showUserApp(0, userAddress);
console.log('app:', app);string
Promise<{ app: App; objAddress: string; }>
transferApp(
appAddress,to):Promise<{address:string;to:string;txHash:string; }>
ONLY APP OWNER
transfer the ownership of an app to the specified address
NB: when transferring the ownership to a contract, the receiver contract must implement the ERC721 token receiver interface
example:
const { address, to, txHash } = await transferApp(appAddress, receiverAddress);
console.log(`app ${address} ownership transferred to ${address} in tx ${txHash}`);string
string
Promise<{ address: string; to: string; txHash: string; }>
staticfromConfig(config):IExecAppModule
Create an IExecAppModule instance using an IExecConfig instance
IExecAppModule