Skip to content

Latest commit

 

History

History
340 lines (197 loc) · 5.96 KB

File metadata and controls

340 lines (197 loc) · 5.96 KB

iexec


iexec / IExecAppModule

Class: IExecAppModule

module exposing app methods

Extends

Constructors

Constructor

new IExecAppModule(configOrArgs, options?): IExecAppModule

Create an IExecModule instance

Parameters

configOrArgs

IExecConfigArgs | IExecConfig

options?

IExecConfigOptions

Returns

IExecAppModule

Inherited from

IExecModule.constructor

Properties

config

config: IExecConfig

current IExecConfig

Inherited from

IExecModule.config

Methods

checkAppSecretExists()

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

Parameters

appAddress

string

options?
teeFramework?

TeeFramework

Returns

Promise<boolean>


checkDeployedApp()

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);

Parameters

appAddress

string

Returns

Promise<Boolean>


countUserApps()

countUserApps(userAddress): Promise<BN>

count the apps owned by an address.

example:

const count = await countUserApps(userAddress);
console.log('app count:', count);

Parameters

userAddress

string

Returns

Promise<BN>


deployApp()

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);

Parameters

app

AppDeploymentArgs

Returns

Promise<{ address: string; txHash: string; }>


predictAppAddress()

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);

Parameters

app

AppDeploymentArgs

Returns

Promise<string>


pushAppSecret()

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 tee tasks.
  • 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);

Parameters

appAddress

string

secretValue

String

options?
teeFramework?

TeeFramework

Returns

Promise<boolean>


showApp()

showApp(appAddress): Promise<{ app: App; objAddress: string; }>

show a deployed app details

example:

const { app } = await showApp('0xb9b56f1c78f39504263835342e7affe96536d1ea');
console.log('app:', app);

Parameters

appAddress

string

Returns

Promise<{ app: App; objAddress: string; }>


showUserApp()

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);

Parameters

index

BNish

address

string

Returns

Promise<{ app: App; objAddress: string; }>


transferApp()

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}`);

Parameters

appAddress

string

to

string

Returns

Promise<{ address: string; to: string; txHash: string; }>


fromConfig()

static fromConfig(config): IExecAppModule

Create an IExecAppModule instance using an IExecConfig instance

Parameters

config

IExecConfig

Returns

IExecAppModule

Overrides

IExecModule.fromConfig