JavaScript cURL Python

Defender API

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Base URLs:

API Authentication

Defender APIs use short-lived JWT tokens for authentication, which can be negotiated via SRP protocol. We suggest using the Amazon Cognito User Pool SDK to negotiate the token.

The JWT token will expire after 60 minutes. If your code requires sessions longer than 60 minutes, consider recreating the JWT token, or using a refresh token.

Making Authenticated Requests

Code sample

API_URL='http://api.defender.openzeppelin.com/v2'

curl \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json' \
    -H 'X-Api-Key: $KEY' \
    -H 'Authorization: Bearer $JWT' \
        '$API_URL/$END_POINT'
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
import boto3
from warrant.aws_srp import AWSSRP

client = boto3.client('cognito-idp', region_name='us-west-2')
aws = AWSSRP(username='API_KEY', password='API_SECRET', pool_id='POOL_ID', client_id='CLIENT_ID', client=client)
tokens = aws.authenticate_user()
print('Access Token', tokens['AuthenticationResult']['AccessToken'])

Once you get a JWT Token you can make requests to the Defender API. A request requires an API key, a JWT Token, optionally a payload, and an API URL. Set $KEY, $TOKEN to the values of API key and JWT Token acquired before. $END_POINT can be any of the paths described in the following sections.

Deploy

List Block Explorer Api Key

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.listBlockExplorerApiKeys();


curl -X GET https://api.defender.openzeppelin.com/v2/block-explorer-api-key \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/block-explorer-api-key', headers = headers)

print(r.json())

GET /block-explorer-api-key

Example responses

200 Response

{
  "blockExplorerApiKeyId": "string",
  "createdAt": "string",
  "network": "mainnet",
  "stackResourceId": "string",
  "keyHash": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Block Explorer Api Key

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.createBlockExplorerApiKey(body);


curl -X POST https://api.defender.openzeppelin.com/v2/block-explorer-api-key \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/block-explorer-api-key', headers = headers)

print(r.json())

POST /block-explorer-api-key

Body parameter

{
  "key": "string",
  "network": "mainnet",
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "blockExplorerApiKeyId": "string",
  "createdAt": "string",
  "network": "mainnet",
  "stackResourceId": "string",
  "keyHash": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Deployment Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getConfig(deploymentConfigId);


curl -X GET https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId}', headers = headers)

print(r.json())

GET /deployment-config/{deploymentConfigId}

Parameters

Name In Type Required Description
deploymentConfigId path string true none

Example responses

200 Response

{
  "deploymentConfigId": "string",
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "network": "mainnet",
  "createdAt": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Deployment Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.updateConfig(deploymentConfigId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId} \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId}', headers = headers)

print(r.json())

PUT /deployment-config/{deploymentConfigId}

Body parameter

{
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
deploymentConfigId path string true none

Example responses

200 Response

{
  "deploymentConfigId": "string",
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "network": "mainnet",
  "createdAt": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Remove Deployment Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.deleteConfig(deploymentConfigId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/deployment-config/{deploymentConfigId}', headers = headers)

print(r.json())

DELETE /deployment-config/{deploymentConfigId}

Parameters

Name In Type Required Description
deploymentConfigId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Verifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.verify(body);


curl -X POST https://api.defender.openzeppelin.com/v2/verifications \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/verifications', headers = headers)

print(r.json())

POST /verifications

Body parameter

{
  "artifactUri": "string",
  "solidityFilePath": "string",
  "contractName": "string",
  "contractAddress": "string",
  "contractNetwork": "mainnet",
  "artifactPayload": "string",
  "referenceUri": "string"
}

Responses

Status Meaning Description Schema

Get Deployments

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getDeployedContract(deploymentId);


curl -X GET https://api.defender.openzeppelin.com/v2/deployments/{deploymentId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/deployments/{deploymentId}', headers = headers)

print(r.json())

GET /deployments/{deploymentId}

Parameters

Name In Type Required Description
deploymentId path string true none

Example responses

200 Response

{
  "deploymentId": "string",
  "createdAt": "string",
  "contractName": "string",
  "contractPath": "string",
  "network": "mainnet",
  "relayerId": "string",
  "approvalProcessId": "string",
  "createFactoryAddress": "string",
  "address": "string",
  "status": "submitted",
  "pending": 0,
  "blockExplorerVerification": {
    "status": "string",
    "error": "string",
    "etherscanGuid": "string"
  },
  "deployDataVerification": "string",
  "bytecodeVerification": "string",
  "deploymentArtifactId": "string",
  "transactionId": "string",
  "txHash": "string",
  "abi": "string",
  "bytecode": "string",
  "constructorBytecode": "string",
  "value": "string",
  "salt": "string",
  "safeTxHash": "string",
  "licenseType": "None",
  "libraries": {
    "property1": "string",
    "property2": "string"
  },
  "constructorInputs": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Deployments

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.listDeployments();


curl -X GET https://api.defender.openzeppelin.com/v2/deployments \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/deployments', headers = headers)

print(r.json())

GET /deployments

Example responses

200 Response

{
  "deploymentId": "string",
  "createdAt": "string",
  "contractName": "string",
  "contractPath": "string",
  "network": "mainnet",
  "relayerId": "string",
  "approvalProcessId": "string",
  "createFactoryAddress": "string",
  "address": "string",
  "status": "submitted",
  "pending": 0,
  "blockExplorerVerification": {
    "status": "string",
    "error": "string",
    "etherscanGuid": "string"
  },
  "deployDataVerification": "string",
  "bytecodeVerification": "string",
  "deploymentArtifactId": "string",
  "transactionId": "string",
  "txHash": "string",
  "abi": "string",
  "bytecode": "string",
  "constructorBytecode": "string",
  "value": "string",
  "salt": "string",
  "safeTxHash": "string",
  "licenseType": "None",
  "libraries": {
    "property1": "string",
    "property2": "string"
  },
  "constructorInputs": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Deployments

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.deployContract(body);


curl -X POST https://api.defender.openzeppelin.com/v2/deployments \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/deployments', headers = headers)

print(r.json())

POST /deployments

Body parameter

{
  "contractName": "string",
  "contractPath": "string",
  "network": "mainnet",
  "artifactPayload": "string",
  "artifactUri": "string",
  "value": "string",
  "salt": "string",
  "verifySourceCode": true,
  "licenseType": "None",
  "libraries": {
    "property1": "string",
    "property2": "string"
  },
  "constructorInputs": [
    "string"
  ],
  "constructorBytecode": "string",
  "txOverrides": {
    "gasLimit": 0,
    "gasPrice": "string",
    "maxFeePerGas": "string",
    "maxPriorityFeePerGas": "string"
  },
  "relayerId": "string",
  "approvalProcessId": "string",
  "createFactoryAddress": "string"
}

Example responses

200 Response

{
  "deploymentId": "string",
  "createdAt": "string",
  "contractName": "string",
  "contractPath": "string",
  "network": "mainnet",
  "relayerId": "string",
  "approvalProcessId": "string",
  "createFactoryAddress": "string",
  "address": "string",
  "status": "submitted",
  "pending": 0,
  "blockExplorerVerification": {
    "status": "string",
    "error": "string",
    "etherscanGuid": "string"
  },
  "deployDataVerification": "string",
  "bytecodeVerification": "string",
  "deploymentArtifactId": "string",
  "transactionId": "string",
  "txHash": "string",
  "abi": "string",
  "bytecode": "string",
  "constructorBytecode": "string",
  "value": "string",
  "salt": "string",
  "safeTxHash": "string",
  "licenseType": "None",
  "libraries": {
    "property1": "string",
    "property2": "string"
  },
  "constructorInputs": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Upgrades

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.upgradeContract(body);


curl -X POST https://api.defender.openzeppelin.com/v2/upgrades \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/upgrades', headers = headers)

print(r.json())

POST /upgrades

Body parameter

{
  "proxyAddress": "string",
  "senderAddress": "string",
  "proxyAdminAddress": "string",
  "newImplementationABI": "string",
  "newImplementationAddress": "string",
  "network": "mainnet",
  "approvalProcessId": "string"
}

Example responses

200 Response

{
  "proposalId": "string",
  "transaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "externalUrl": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Block Explorer Api Key

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getBlockExplorerApiKeys(blockExplorerApiKeyId);


curl -X GET https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId}', headers = headers)

print(r.json())

GET /block-explorer-api-key/{blockExplorerApiKeyId}

Parameters

Name In Type Required Description
blockExplorerApiKeyId path string true none

Example responses

200 Response

{
  "blockExplorerApiKeyId": "string",
  "createdAt": "string",
  "network": "mainnet",
  "stackResourceId": "string",
  "keyHash": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Block Explorer Api Key

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.updateBlockExplorerApiKeys(blockExplorerApiKeyId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId} \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId}', headers = headers)

print(r.json())

PUT /block-explorer-api-key/{blockExplorerApiKeyId}

Body parameter

{
  "key": "string",
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
blockExplorerApiKeyId path string true none

Example responses

200 Response

{
  "blockExplorerApiKeyId": "string",
  "createdAt": "string",
  "network": "mainnet",
  "stackResourceId": "string",
  "keyHash": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Remove Block Explorer Api Key

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.removeBlockExplorerApiKey(blockExplorerApiKeyId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/block-explorer-api-key/{blockExplorerApiKeyId}', headers = headers)

print(r.json())

DELETE /block-explorer-api-key/{blockExplorerApiKeyId}

Parameters

Name In Type Required Description
blockExplorerApiKeyId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Deployments Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getDeployApprovalProcess(network);


curl -X GET https://api.defender.openzeppelin.com/v2/deployments/config/{network} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/deployments/config/{network}', headers = headers)

print(r.json())

GET /deployments/config/{network}

Parameters

Name In Type Required Description
network path string true none

Example responses

200 Response

{
  "deploymentConfigId": "string",
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "network": "mainnet",
  "createdAt": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Verifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getVerification(contractAddress, contractNetwork);


curl -X GET https://api.defender.openzeppelin.com/v2/verifications/{contractNetwork}/{contractAddress} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/verifications/{contractNetwork}/{contractAddress}', headers = headers)

print(r.json())

GET /verifications/{contractNetwork}/{contractAddress}

Parameters

Name In Type Required Description
contractAddress path string true none
contractNetwork path string true none

Example responses

200 Response

{
  "verificationId": "string",
  "artifactUri": "string",
  "solidityFilePath": "string",
  "contractName": "string",
  "contractAddress": "string",
  "contractNetwork": "mainnet",
  "onChainSha256": "string",
  "providedSha256": "string",
  "lastVerifiedAt": "2019-08-24T14:15:22Z",
  "matchType": "NO_MATCH",
  "providedBy": "string",
  "providedByType": "USER_EMAIL",
  "artifactType": "HARDHAT_BUILD_INFO",
  "referenceUri": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Upgrades Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.getUpgradeApprovalProcess(network);


curl -X GET https://api.defender.openzeppelin.com/v2/upgrades/config/{network} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/upgrades/config/{network}', headers = headers)

print(r.json())

GET /upgrades/config/{network}

Parameters

Name In Type Required Description
network path string true none

Example responses

200 Response

{
  "tenantId": "string",
  "approvalProcessId": "string",
  "createdAt": "string",
  "name": "string",
  "component": [
    "deploy"
  ],
  "network": "mainnet",
  "via": "string",
  "viaType": "EOA",
  "timelock": {
    "address": "string",
    "delay": "string"
  },
  "multisigSender": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "relayerId": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Deployment Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.listConfig();


curl -X GET https://api.defender.openzeppelin.com/v2/deployment-config \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/deployment-config', headers = headers)

print(r.json())

GET /deployment-config

Example responses

200 Response

{
  "deploymentConfigId": "string",
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "network": "mainnet",
  "createdAt": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Deployment Config

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.deploy.createConfig(body);


curl -X POST https://api.defender.openzeppelin.com/v2/deployment-config \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/deployment-config', headers = headers)

print(r.json())

POST /deployment-config

Body parameter

{
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "deploymentConfigId": "string",
  "relayerId": "string",
  "multisig": "string",
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "network": "mainnet",
  "createdAt": "string",
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Proposal

List Proposals

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.list();


curl -X GET https://api.defender.openzeppelin.com/v2/proposals \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/proposals', headers = headers)

print(r.json())

GET /proposals

Example responses

200 Response

{
  "contractId": "string",
  "title": "string",
  "approvalProcessId": "string",
  "type": "batch",
  "transaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "via": "string",
  "viaType": "EOA",
  "timelock": {
    "address": "string",
    "delay": "string",
    "executeTransaction": {
      "to": "string",
      "from": "string",
      "value": "string",
      "data": "string",
      "nonce": "string",
      "safe": {
        "txGas": "string",
        "txHash": "string",
        "operationType": "call"
      },
      "executionTxHash": "string",
      "confirmations": [
        {
          "owner": "string",
          "signature": "string"
        }
      ],
      "isSuccessful": true,
      "isExecuted": true,
      "isReverted": true,
      "fireblocksTransactionId": "string",
      "relayerTransactionId": "string"
    },
    "target": "string",
    "data": "string",
    "salt": "string",
    "operationId": "string"
  },
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "relayerId": "string",
  "targetFunction": {
    "name": "string",
    "inputs": [
      {
        "name": "string",
        "type": "string",
        "internalType": "string",
        "components": [
          {}
        ]
      }
    ]
  },
  "functionInputs": [
    "string"
  ],
  "cancelTransaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "description": "string",
  "metadata": {
    "newImplementationAddress": "string",
    "newImplementationAbi": "string",
    "proxyAdminAddress": "string",
    "action": "pause",
    "operationType": "call",
    "account": "string",
    "role": "string",
    "sendTo": "string",
    "sendValue": "string",
    "sendCurrency": {
      "name": "string",
      "symbol": "string",
      "address": "string",
      "network": "mainnet",
      "decimals": 0,
      "type": "ERC20"
    }
  },
  "isArchived": true,
  "lastCheckedBlock": 0,
  "steps": [
    {
      "contractId": "string",
      "targetFunction": {
        "name": "string",
        "inputs": [
          {
            "name": "string",
            "type": "string",
            "internalType": "string",
            "components": [
              {}
            ]
          }
        ]
      },
      "functionInputs": [
        "string"
      ],
      "metadata": {
        "newImplementationAddress": "string",
        "newImplementationAbi": "string",
        "proxyAdminAddress": "string",
        "action": "pause",
        "operationType": "call",
        "account": "string",
        "role": "string",
        "sendTo": "string",
        "sendValue": "string",
        "sendCurrency": {
          "name": "string",
          "symbol": "string",
          "address": "string",
          "network": "mainnet",
          "decimals": 0,
          "type": "ERC20"
        }
      },
      "type": "custom"
    }
  ],
  "contractProposalIdSync": "string",
  "sender": "string",
  "scenarioRunId": "string",
  "scenarioRunTaskName": "string",
  "proposalTemplateId": "string",
  "shouldSync": true,
  "product": "proposal",
  "contractIds": [
    "string"
  ],
  "proposalId": "string",
  "createdAt": "string",
  "lastActivityAt": "string",
  "lastActiveAt": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Proposals

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.create(body);


curl -X POST https://api.defender.openzeppelin.com/v2/proposals \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/proposals', headers = headers)

print(r.json())

POST /proposals

Body parameter

{
  "contract": {
    "network": "mainnet",
    "address": "string",
    "name": "string",
    "abi": "string"
  },
  "title": "string",
  "description": "string",
  "type": "batch",
  "metadata": {
    "newImplementationAddress": "string",
    "newImplementationAbi": "string",
    "proxyAdminAddress": "string",
    "action": "pause",
    "operationType": "call",
    "account": "string",
    "role": "string",
    "sendTo": "string",
    "sendValue": "string",
    "sendCurrency": {
      "name": "string",
      "symbol": "string",
      "address": "string",
      "network": "mainnet",
      "decimals": 0,
      "type": "ERC20"
    }
  },
  "via": "string",
  "viaType": "EOA",
  "relayerId": "string",
  "functionInterface": {
    "name": "string",
    "inputs": [
      {
        "name": "string",
        "type": "string",
        "internalType": "string",
        "components": [
          {}
        ]
      }
    ]
  },
  "functionInputs": [
    "string"
  ],
  "transaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "timelock": {
    "address": "string",
    "delay": "string",
    "executeTransaction": {
      "to": "string",
      "from": "string",
      "value": "string",
      "data": "string",
      "nonce": "string",
      "safe": {
        "txGas": "string",
        "txHash": "string",
        "operationType": "call"
      },
      "executionTxHash": "string",
      "confirmations": [
        {
          "owner": "string",
          "signature": "string"
        }
      ],
      "isSuccessful": true,
      "isExecuted": true,
      "isReverted": true,
      "fireblocksTransactionId": "string",
      "relayerTransactionId": "string"
    },
    "target": "string",
    "data": "string",
    "salt": "string",
    "operationId": "string"
  },
  "cancelTransaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "steps": [
    {
      "contractId": "string",
      "targetFunction": {
        "name": "string",
        "inputs": [
          {
            "name": "string",
            "type": "string",
            "internalType": "string",
            "components": [
              {}
            ]
          }
        ]
      },
      "functionInputs": [
        "string"
      ],
      "metadata": {
        "newImplementationAddress": "string",
        "newImplementationAbi": "string",
        "proxyAdminAddress": "string",
        "action": "pause",
        "operationType": "call",
        "account": "string",
        "role": "string",
        "sendTo": "string",
        "sendValue": "string",
        "sendCurrency": {
          "name": "string",
          "symbol": "string",
          "address": "string",
          "network": "mainnet",
          "decimals": 0,
          "type": "ERC20"
        }
      },
      "type": "custom"
    }
  ]
}

Responses

Status Meaning Description Schema

Get Proposals Details

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.get(proposalId);


curl -X GET https://api.defender.openzeppelin.com/v2/proposals/details/{proposalId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/proposals/details/{proposalId}', headers = headers)

print(r.json())

GET /proposals/details/{proposalId}

Parameters

Name In Type Required Description
proposalId path string true none

Example responses

200 Response

{
  "contractId": "string",
  "title": "string",
  "approvalProcessId": "string",
  "type": "batch",
  "transaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "via": "string",
  "viaType": "EOA",
  "timelock": {
    "address": "string",
    "delay": "string",
    "executeTransaction": {
      "to": "string",
      "from": "string",
      "value": "string",
      "data": "string",
      "nonce": "string",
      "safe": {
        "txGas": "string",
        "txHash": "string",
        "operationType": "call"
      },
      "executionTxHash": "string",
      "confirmations": [
        {
          "owner": "string",
          "signature": "string"
        }
      ],
      "isSuccessful": true,
      "isExecuted": true,
      "isReverted": true,
      "fireblocksTransactionId": "string",
      "relayerTransactionId": "string"
    },
    "target": "string",
    "data": "string",
    "salt": "string",
    "operationId": "string"
  },
  "fireblocks": {
    "apiKeyId": "string",
    "vaultId": "string",
    "assetId": "string"
  },
  "relayerId": "string",
  "targetFunction": {
    "name": "string",
    "inputs": [
      {
        "name": "string",
        "type": "string",
        "internalType": "string",
        "components": [
          {}
        ]
      }
    ]
  },
  "functionInputs": [
    "string"
  ],
  "cancelTransaction": {
    "to": "string",
    "from": "string",
    "value": "string",
    "data": "string",
    "nonce": "string",
    "safe": {
      "txGas": "string",
      "txHash": "string",
      "operationType": "call"
    },
    "executionTxHash": "string",
    "confirmations": [
      {
        "owner": "string",
        "signature": "string"
      }
    ],
    "isSuccessful": true,
    "isExecuted": true,
    "isReverted": true,
    "fireblocksTransactionId": "string",
    "relayerTransactionId": "string"
  },
  "description": "string",
  "metadata": {
    "newImplementationAddress": "string",
    "newImplementationAbi": "string",
    "proxyAdminAddress": "string",
    "action": "pause",
    "operationType": "call",
    "account": "string",
    "role": "string",
    "sendTo": "string",
    "sendValue": "string",
    "sendCurrency": {
      "name": "string",
      "symbol": "string",
      "address": "string",
      "network": "mainnet",
      "decimals": 0,
      "type": "ERC20"
    }
  },
  "isArchived": true,
  "lastCheckedBlock": 0,
  "steps": [
    {
      "contractId": "string",
      "targetFunction": {
        "name": "string",
        "inputs": [
          {
            "name": "string",
            "type": "string",
            "internalType": "string",
            "components": [
              {}
            ]
          }
        ]
      },
      "functionInputs": [
        "string"
      ],
      "metadata": {
        "newImplementationAddress": "string",
        "newImplementationAbi": "string",
        "proxyAdminAddress": "string",
        "action": "pause",
        "operationType": "call",
        "account": "string",
        "role": "string",
        "sendTo": "string",
        "sendValue": "string",
        "sendCurrency": {
          "name": "string",
          "symbol": "string",
          "address": "string",
          "network": "mainnet",
          "decimals": 0,
          "type": "ERC20"
        }
      },
      "type": "custom"
    }
  ],
  "contractProposalIdSync": "string",
  "sender": "string",
  "scenarioRunId": "string",
  "scenarioRunTaskName": "string",
  "proposalTemplateId": "string",
  "shouldSync": true,
  "product": "proposal",
  "contractIds": [
    "string"
  ],
  "proposalId": "string",
  "createdAt": "string",
  "lastActivityAt": "string",
  "lastActiveAt": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Proposals Archive

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.archive(proposalId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/proposals/archive/{proposalId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/proposals/archive/{proposalId}', headers = headers)

print(r.json())

PUT /proposals/archive/{proposalId}

Body parameter

{}

Parameters

Name In Type Required Description
proposalId path string true none

Responses

Status Meaning Description Schema

Update Proposals Unarchive

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.unarchive(proposalId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/proposals/unarchive/{proposalId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/proposals/unarchive/{proposalId}', headers = headers)

print(r.json())

PUT /proposals/unarchive/{proposalId}

Body parameter

{}

Parameters

Name In Type Required Description
proposalId path string true none

Responses

Status Meaning Description Schema

Create Contracts Proposals Simulate

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.simulate(proposalId, contractId, body);


curl -X POST https://api.defender.openzeppelin.com/v2/contracts/{contractId}/proposals/{proposalId}/simulate \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/contracts/{contractId}/proposals/{proposalId}/simulate', headers = headers)

print(r.json())

POST /contracts/{contractId}/proposals/{proposalId}/simulate

Body parameter

{}

Parameters

Name In Type Required Description
proposalId path string true none
contractId path string true none

Responses

Status Meaning Description Schema

Get Contracts Proposals Simulation

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.getSimulation(proposalId, contractId);


curl -X GET https://api.defender.openzeppelin.com/v2/contracts/{contractId}/proposals/{proposalId}/simulation \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/contracts/{contractId}/proposals/{proposalId}/simulation', headers = headers)

print(r.json())

GET /contracts/{contractId}/proposals/{proposalId}/simulation

Parameters

Name In Type Required Description
proposalId path string true none
contractId path string true none

Example responses

200 Response

{
  "contractProposalId": "string",
  "createdAt": "string",
  "transaction": {
    "to": "string",
    "from": "string",
    "data": "string",
    "value": "string",
    "nonce": 0,
    "gasPrice": 0,
    "gasLimit": 0,
    "maxFeePerGas": 0
  },
  "meta": {
    "network": "string",
    "blockNumber": 0,
    "forkedBlockNumber": 0,
    "simulatedBlockNumber": 0,
    "gasUsed": 0,
    "returnValue": "string",
    "returnString": "string",
    "reverted": true
  },
  "states": [
    {
      "function": "string",
      "types": [
        "string"
      ],
      "states": {
        "previous": "string",
        "current": "string"
      }
    }
  ],
  "events": [
    {
      "address": "string",
      "name": "string",
      "signature": "string",
      "topics": [
        "string"
      ],
      "args": [
        {
          "name": "string",
          "type": "string",
          "indexed": true,
          "value": "string"
        }
      ]
    }
  ],
  "logs": [
    [
      "string",
      "string",
      "string"
    ]
  ],
  "storage": [
    {
      "address": "string",
      "slot": "string",
      "states": {
        "previous": "string",
        "current": "string"
      }
    }
  ],
  "traces": [
    {
      "depth": 0,
      "type": "string",
      "gas": "string",
      "to": "string",
      "value": "string",
      "data": "string"
    }
  ],
  "transfers": [
    {
      "depth": 0,
      "type": "string",
      "gas": "string",
      "to": "string",
      "value": "string",
      "data": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Relay

Remove Relayers Keys

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.deleteKey(relayerId, keyId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys/{keyId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys/{keyId}', headers = headers)

print(r.json())

DELETE /relayers/{relayerId}/keys/{keyId}

Parameters

Name In Type Required Description
relayerId path string true none
keyId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Relayers Summary

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.list();


curl -X GET https://api.defender.openzeppelin.com/v2/relayers/summary \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/relayers/summary', headers = headers)

print(r.json())

GET /relayers/summary

Example responses

200 Response

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Relayers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.update(body);


curl -X PUT https://api.defender.openzeppelin.com/v2/relayers \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/relayers', headers = headers)

print(r.json())

PUT /relayers

Body parameter

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Relayers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.create(body);


curl -X POST https://api.defender.openzeppelin.com/v2/relayers \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/relayers', headers = headers)

print(r.json())

POST /relayers

Body parameter

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Relayers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.get(relayerId);


curl -X GET https://api.defender.openzeppelin.com/v2/relayers/{relayerId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/relayers/{relayerId}', headers = headers)

print(r.json())

GET /relayers/{relayerId}

Parameters

Name In Type Required Description
relayerId path string true none

Example responses

200 Response

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Relayers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.update(relayerId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/relayers/{relayerId} \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/relayers/{relayerId}', headers = headers)

print(r.json())

PUT /relayers/{relayerId}

Body parameter

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
relayerId path string true none

Example responses

200 Response

{
  "name": "string",
  "useAddressFromRelayerId": "string",
  "network": "mainnet",
  "minBalance": "string",
  "policies": {
    "gasPriceCap": "string",
    "whitelistReceivers": [
      "string"
    ],
    "EIP1559Pricing": true,
    "privateTransactions": true
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Relayers Keys

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.getKey(relayerId);


curl -X GET https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys', headers = headers)

print(r.json())

GET /relayers/{relayerId}/keys

Parameters

Name In Type Required Description
relayerId path string true none

Example responses

200 Response

{
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Relayers Keys

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.relay.createKey(relayerId, body);


curl -X POST https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/relayers/{relayerId}/keys', headers = headers)

print(r.json())

POST /relayers/{relayerId}/keys

Body parameter

{
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
relayerId path string true none

Example responses

200 Response

{
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Notification

Get Notifications Categories

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.getNotificationCategory(categoryId);


curl -X GET https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId}', headers = headers)

print(r.json())

GET /notifications/categories/{categoryId}

Parameters

Name In Type Required Description
categoryId path string true none

Example responses

200 Response

{
  "categoryId": "string",
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Notifications Categories

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.updateNotificationCategory(categoryId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId} \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId}', headers = headers)

print(r.json())

PUT /notifications/categories/{categoryId}

Body parameter

{
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
categoryId path string true none

Example responses

200 Response

{
  "categoryId": "string",
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Remove Notifications Categories

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.deleteNotificationCategory(categoryId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/notifications/categories/{categoryId}', headers = headers)

print(r.json())

DELETE /notifications/categories/{categoryId}

Parameters

Name In Type Required Description
categoryId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Notifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.getNotificationChannel(type, notificationId);


curl -X GET https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId}', headers = headers)

print(r.json())

GET /notifications/{type}/{notificationId}

Parameters

Name In Type Required Description
type path string true none
notificationId path string true none

Example responses

200 Response

{
  "notificationId": "string",
  "name": "string",
  "type": "slack",
  "paused": true,
  "pausedUntil": "string",
  "config": {
    "token": "string",
    "eventType": "alert",
    "routingKey": "stringstringstringstringstringst",
    "eventAction": "trigger",
    "dedupKey": "string",
    "severity": "critical",
    "component": "string",
    "group": "string",
    "class": "string",
    "customDetails": {
      "property1": "string",
      "property2": "string"
    }
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Notifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.updateNotificationChannel(type, notificationId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId}', headers = headers)

print(r.json())

PUT /notifications/{type}/{notificationId}

Body parameter

{
  "name": "string",
  "config": {
    "url": "http://example.com"
  },
  "paused": false,
  "pausedUntil": "string",
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
type path string true none
notificationId path string true none

Responses

Status Meaning Description Schema

Remove Notifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.deleteNotificationChannel(type, notificationId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/notifications/{type}/{notificationId}', headers = headers)

print(r.json())

DELETE /notifications/{type}/{notificationId}

Parameters

Name In Type Required Description
type path string true none
notificationId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Notifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.listNotificationChannels();


curl -X GET https://api.defender.openzeppelin.com/v2/notifications \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/notifications', headers = headers)

print(r.json())

GET /notifications

Example responses

200 Response

{
  "notificationId": "string",
  "name": "string",
  "type": "slack",
  "paused": true,
  "pausedUntil": "string",
  "config": {
    "token": "string",
    "eventType": "alert",
    "routingKey": "stringstringstringstringstringst",
    "eventAction": "trigger",
    "dedupKey": "string",
    "severity": "critical",
    "component": "string",
    "group": "string",
    "class": "string",
    "customDetails": {
      "property1": "string",
      "property2": "string"
    }
  },
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Notifications

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.createNotificationChannel(type, body);


curl -X POST https://api.defender.openzeppelin.com/v2/notifications/{type} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/notifications/{type}', headers = headers)

print(r.json())

POST /notifications/{type}

Body parameter

{
  "type": "slack",
  "saveReq": {}
}

Parameters

Name In Type Required Description
type path string true none

Responses

Status Meaning Description Schema

List Notifications Categories

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.listNotificationCategories();


curl -X GET https://api.defender.openzeppelin.com/v2/notifications/categories \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/notifications/categories', headers = headers)

print(r.json())

GET /notifications/categories

Example responses

200 Response

{
  "categoryId": "string",
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Notifications Categories

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.createNotificationCategory(body);


curl -X POST https://api.defender.openzeppelin.com/v2/notifications/categories \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/notifications/categories', headers = headers)

print(r.json())

POST /notifications/categories

Body parameter

{
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "categoryId": "string",
  "name": "string",
  "description": "string",
  "notificationIds": [],
  "stackResourceId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Action

Create Actions Runs Manual

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.runAction(actionId, body);


curl -X POST https://api.defender.openzeppelin.com/v2/actions/{actionId}/runs/manual \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/actions/{actionId}/runs/manual', headers = headers)

print(r.json())

POST /actions/{actionId}/runs/manual

Body parameter

{}

Parameters

Name In Type Required Description
actionId path string true none

Responses

Status Meaning Description Schema

Get Actions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.get(actionId);


curl -X GET https://api.defender.openzeppelin.com/v2/actions/{actionId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/actions/{actionId}', headers = headers)

print(r.json())

GET /actions/{actionId}

Parameters

Name In Type Required Description
actionId path string true none

Example responses

200 Response

{
  "name": "string",
  "encodedZippedCode": "string",
  "relayerId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "paused": true,
  "stackResourceId": "string",
  "dependenciesVersion": "string",
  "autotaskId": "string",
  "codeDigest": "string",
  "createdAt": "string",
  "runtime": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Remove Actions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.delete(actionId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/actions/{actionId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/actions/{actionId}', headers = headers)

print(r.json())

DELETE /actions/{actionId}

Parameters

Name In Type Required Description
actionId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Actions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.list();


curl -X GET https://api.defender.openzeppelin.com/v2/actions \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/actions', headers = headers)

print(r.json())

GET /actions

Example responses

200 Response

{
  "name": "string",
  "encodedZippedCode": "string",
  "relayerId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "paused": true,
  "stackResourceId": "string",
  "dependenciesVersion": "string",
  "autotaskId": "string",
  "codeDigest": "string",
  "createdAt": "string",
  "runtime": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Actions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.update(body);


curl -X PUT https://api.defender.openzeppelin.com/v2/actions \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/actions', headers = headers)

print(r.json())

PUT /actions

Body parameter

{
  "autotaskId": "string",
  "actionId": "string",
  "name": "string",
  "encodedZippedCode": "string",
  "relayerId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "paused": true,
  "stackResourceId": "string",
  "dependenciesVersion": "string",
  "environmentVariables": {
    "property1": "string",
    "property2": "string"
  }
}

Responses

Status Meaning Description Schema

Create Actions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.create(body);


curl -X POST https://api.defender.openzeppelin.com/v2/actions \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/actions', headers = headers)

print(r.json())

POST /actions

Body parameter

{
  "name": "string",
  "encodedZippedCode": "string",
  "relayerId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "paused": true,
  "stackResourceId": "string",
  "dependenciesVersion": "string",
  "environmentVariables": {
    "property1": "string",
    "property2": "string"
  }
}

Responses

Status Meaning Description Schema

Get Actions Runs

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.listActionRuns(actionId);


curl -X GET https://api.defender.openzeppelin.com/v2/actions/{actionId}/runs \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/actions/{actionId}/runs', headers = headers)

print(r.json())

GET /actions/{actionId}/runs

Parameters

Name In Type Required Description
actionId path string true none

Example responses

200 Response

{
  "autotaskRunId": "string",
  "autotaskId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "status": "string",
  "createdAt": "string",
  "errorType": "TIMEOUT"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Action Environment

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.getEnvironmentVariables(actionId);


curl -X GET https://api.defender.openzeppelin.com/v2/actions/{actionId}/environment \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/actions/{actionId}/environment', headers = headers)

print(r.json())

GET /actions/{actionId}/environment

Parameters

Name In Type Required Description
actionId path string true none

Example responses

200 Response

{
  "property1": "string",
  "property2": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Actions Environment

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.updateEnvironmentVariables(actionId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/actions/{actionId}/environment \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/actions/{actionId}/environment', headers = headers)

print(r.json())

PUT /actions/{actionId}/environment

Body parameter

{
  "variables": {
    "property1": "string",
    "property2": "string"
  }
}

Parameters

Name In Type Required Description
actionId path string true none

Example responses

200 Response

{
  "property1": "string",
  "property2": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Actions Runs

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.getActionRun(actionRunId);


curl -X GET https://api.defender.openzeppelin.com/v2/actions/runs/{actionRunId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/actions/runs/{actionRunId}', headers = headers)

print(r.json())

GET /actions/runs/{actionRunId}

Parameters

Name In Type Required Description
actionRunId path string true none

Example responses

200 Response

{
  "autotaskRunId": "string",
  "autotaskId": "string",
  "trigger": {
    "type": "schedule",
    "frequencyMinutes": 0,
    "cron": "string"
  },
  "status": "string",
  "createdAt": "string",
  "errorType": "TIMEOUT"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Monitor

List Blockwatchers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.listBlockwatchers();


curl -X GET https://api.defender.openzeppelin.com/v2/blockwatchers \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/blockwatchers', headers = headers)

print(r.json())

GET /blockwatchers

Example responses

200 Response

{
  "blockWatcherId": "string",
  "network": "mainnet",
  "lastBlockNumber": "string",
  "lastConsensusTimestamp": "string",
  "lastUpdatedAt": "string",
  "blockIntervalMs": 0,
  "paused": true,
  "traceBlock": true,
  "confirmLevel": "string",
  "options": {
    "processBlockAttempts": 0,
    "processBlockAttemptTimeoutMs": 0,
    "processBlockBatchSize": 0,
    "traceAttempts": 0,
    "traceTimeoutMinTimeoutMs": 0,
    "traceTimeoutMaxTimeoutMs": 0
  }
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Tenant Blockwatchers

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.listTenantBlockwatchers(body);


curl -X GET https://api.defender.openzeppelin.com/v2/blockwatchers/tenant \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/blockwatchers/tenant', headers = headers)

print(r.json())

GET /blockwatchers/tenant

Body parameter

{
  "blockWatcherId": "string",
  "network": "mainnet",
  "lastBlockNumber": "string",
  "lastConsensusTimestamp": "string",
  "lastUpdatedAt": "string",
  "blockIntervalMs": 0,
  "paused": true,
  "traceBlock": true,
  "confirmLevel": "string",
  "options": {
    "processBlockAttempts": 0,
    "processBlockAttemptTimeoutMs": 0,
    "processBlockBatchSize": 0,
    "traceAttempts": 0,
    "traceTimeoutMinTimeoutMs": 0,
    "traceTimeoutMaxTimeoutMs": 0
  }
}

Responses

Status Meaning Description Schema

Get Monitors

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.get(monitorId);


curl -X GET https://api.defender.openzeppelin.com/v2/monitors/{monitorId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/monitors/{monitorId}', headers = headers)

print(r.json())

GET /monitors/{monitorId}

Parameters

Name In Type Required Description
monitorId path string true none

Example responses

200 Response

{
  "subscriberId": "string",
  "monitorId": "string",
  "createdAt": "string",
  "blockWatcherId": "string",
  "network": "mainnet",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "type": "FORTA",
  "riskCategory": "NONE",
  "scenarioId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Monitors

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.update(monitorId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/monitors/{monitorId} \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/monitors/{monitorId}', headers = headers)

print(r.json())

PUT /monitors/{monitorId}

Body parameter

{
  "blockWatcherId": "string",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "network": "mainnet",
  "type": "FORTA",
  "riskCategory": "NONE",
  "stackResourceId": "string",
  "scenarioId": "string"
}

Parameters

Name In Type Required Description
monitorId path string true none

Example responses

200 Response

{
  "subscriberId": "string",
  "monitorId": "string",
  "createdAt": "string",
  "blockWatcherId": "string",
  "network": "mainnet",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "type": "FORTA",
  "riskCategory": "NONE",
  "scenarioId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Remove Monitors

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.delete(monitorId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/monitors/{monitorId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/monitors/{monitorId}', headers = headers)

print(r.json())

DELETE /monitors/{monitorId}

Parameters

Name In Type Required Description
monitorId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Monitors

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.list();


curl -X GET https://api.defender.openzeppelin.com/v2/monitors \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/monitors', headers = headers)

print(r.json())

GET /monitors

Example responses

200 Response

{
  "subscriberId": "string",
  "monitorId": "string",
  "createdAt": "string",
  "blockWatcherId": "string",
  "network": "mainnet",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "type": "FORTA",
  "riskCategory": "NONE",
  "scenarioId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Monitors

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.monitor.create(body);


curl -X POST https://api.defender.openzeppelin.com/v2/monitors \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/monitors', headers = headers)

print(r.json())

POST /monitors

Body parameter

{
  "blockWatcherId": "string",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "network": "mainnet",
  "type": "FORTA",
  "riskCategory": "NONE",
  "stackResourceId": "string",
  "scenarioId": "string"
}

Example responses

200 Response

{
  "subscriberId": "string",
  "monitorId": "string",
  "createdAt": "string",
  "blockWatcherId": "string",
  "network": "mainnet",
  "name": "string",
  "paused": false,
  "skipABIValidation": false,
  "addressRules": [
    {
      "conditions": [
        {
          "eventConditions": [
            {
              "eventSignature": "string",
              "expression": "string"
            }
          ],
          "txConditions": [
            {
              "status": "success",
              "expression": "string"
            }
          ],
          "functionConditions": [
            {
              "functionSignature": "string",
              "expression": "string"
            }
          ]
        }
      ],
      "autotaskCondition": {
        "autotaskId": "string"
      },
      "address": "string",
      "addresses": [
        "string"
      ],
      "abi": "string"
    }
  ],
  "fortaRule": {
    "addresses": [
      "string"
    ],
    "agentIDs": [
      "string"
    ],
    "conditions": {
      "alertIDs": [
        "string"
      ],
      "minimumScannerCount": 0,
      "severity": 0
    },
    "autotaskCondition": {
      "autotaskId": "string"
    }
  },
  "privateFortaNodeId": "string",
  "fortaLastProcessedTime": "2019-08-24T14:15:22Z",
  "alertThreshold": {
    "amount": 0,
    "windowSeconds": 0
  },
  "notifyConfig": {
    "notifications": [],
    "notificationCategoryId": "string",
    "autotaskId": "string",
    "messageSubject": "string",
    "messageBody": "string",
    "timeoutMs": 0
  },
  "type": "FORTA",
  "riskCategory": "NONE",
  "scenarioId": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Admin

Remove Contracts

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.deleteContract(contractId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/contracts/{contractId} \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/contracts/{contractId}', headers = headers)

print(r.json())

DELETE /contracts/{contractId}

Parameters

Name In Type Required Description
contractId path string true none

Example responses

200 Response

{
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Secrets

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.listSecrets();


curl -X GET https://api.defender.openzeppelin.com/v2/secrets \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/secrets', headers = headers)

print(r.json())

GET /secrets

Example responses

200 Response

{
  "secretNames": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Create Secrets

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.action.createSecrets(body);


curl -X POST https://api.defender.openzeppelin.com/v2/secrets \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/secrets', headers = headers)

print(r.json())

POST /secrets

Body parameter

{
  "deletes": [
    "string"
  ],
  "secrets": {
    "property1": "string",
    "property2": "string"
  }
}

Example responses

200 Response

{
  "secretNames": [
    "string"
  ]
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

List Contracts

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.listContracts();


curl -X GET https://api.defender.openzeppelin.com/v2/contracts \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/contracts', headers = headers)

print(r.json())

GET /contracts

Example responses

200 Response

{
  "name": "string",
  "contractId": "string",
  "address": "string",
  "network": "mainnet",
  "abi": "string",
  "natSpec": "string",
  "type": "EOA",
  "createdAt": "string",
  "facets": {},
  "state": {
    "owner": "string",
    "accessControl": {
      "roles": []
    },
    "lastUpdatedAt": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Update Contracts

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.proposal.updateContract(body);


curl -X PUT https://api.defender.openzeppelin.com/v2/contracts \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/contracts', headers = headers)

print(r.json())

PUT /contracts

Body parameter

{
  "contractId": "string",
  "name": "string",
  "abi": "string"
}

Responses

Status Meaning Description Schema

Networks

List Networks

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.listSupportedNetworks();


curl -X GET https://api.defender.openzeppelin.com/v2/networks \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/networks', headers = headers)

print(r.json())

GET /networks

Responses

Status Meaning Description Schema

List Forked Networks

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.listForkedNetworks();


curl -X GET https://api.defender.openzeppelin.com/v2/networks/fork \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/networks/fork', headers = headers)

print(r.json())

GET /networks/fork

Responses

Status Meaning Description Schema

Create Forked Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.createForkedNetwork(body);


curl -X POST https://api.defender.openzeppelin.com/v2/networks/fork \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/networks/fork', headers = headers)

print(r.json())

POST /networks/fork

Body parameter

{
  "name": "string",
  "supportedNetwork": "mainnet",
  "rpcUrl": "string",
  "blockExplorerUrl": "string",
  "networkType": "fork",
  "apiKey": "string",
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "tenantNetworkId": "string",
  "name": "string",
  "chainId": 0,
  "supportedNetwork": "mainnet",
  "rpcUrl": "string",
  "apiKey": "string",
  "blockExplorerUrl": "string",
  "stackResourceId": "string",
  "networkType": "fork",
  "configuration": {
    "symbol": "string",
    "eips": {
      "isEIP1559": true
    },
    "safeContracts": {
      "master": "string",
      "proxyFactory": "string",
      "multisendCallOnly": "string",
      "createCall": "string"
    },
    "subgraphURL": "string"
  },
  "createdAt": "string",
  "createdBy": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Forked Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.getForkedNetwork(tenantNetworkId);


curl -X GET https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId} \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId}', headers = headers)

print(r.json())

GET /networks/fork/{tenantNetworkId}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

Update Forked Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.updateForkedNetwork(tenantNetworkId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId}', headers = headers)

print(r.json())

PUT /networks/fork/{tenantNetworkId}

Body parameter

{
  "tenantNetworkId": "string",
  "apiKey": "string",
  "blockExplorerUrl": "string",
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

Delete Forked Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.deleteForkedNetwork(tenantNetworkId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId} \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/networks/fork/{tenantNetworkId}', headers = headers)

print(r.json())

DELETE /networks/fork/{tenantNetworkId}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

List Private Networks

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.listPrivateNetworks();


curl -X GET https://api.defender.openzeppelin.com/v2/networks/private \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/networks/private', headers = headers)

print(r.json())

GET /networks/private

Responses

Status Meaning Description Schema

Create Private Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.createPrivateNetwork(body);


curl -X POST https://api.defender.openzeppelin.com/v2/networks/private \
  -H 'Content-Type: application/json' \  
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/networks/private', headers = headers)

print(r.json())

POST /networks/private

Body parameter

{
  "name": "string",
  "configuration": {
    "symbol": "string",
    "eips": {
      "isEIP1559": true
    },
    "safeContracts": {
      "master": "string",
      "proxyFactory": "string",
      "multisendCallOnly": "string",
      "createCall": "string"
    },
    "subgraphURL": "string"
  },
  "rpcUrl": "string",
  "blockExplorerUrl": "string",
  "networkType": "private",
  "apiKey": "string",
  "stackResourceId": "string"
}

Example responses

200 Response

{
  "tenantNetworkId": "string",
  "name": "string",
  "chainId": 0,
  "supportedNetwork": "mainnet",
  "rpcUrl": "string",
  "apiKey": "string",
  "blockExplorerUrl": "string",
  "stackResourceId": "string",
  "networkType": "fork",
  "configuration": {
    "symbol": "string",
    "eips": {
      "isEIP1559": true
    },
    "safeContracts": {
      "master": "string",
      "proxyFactory": "string",
      "multisendCallOnly": "string",
      "createCall": "string"
    },
    "subgraphURL": "string"
  },
  "createdAt": "string",
  "createdBy": "string"
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Get Private Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.getPrivateNetwork(tenantNetworkId);


curl -X GET https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId} \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId}', headers = headers)

print(r.json())

GET /networks/private/{tenantNetworkId}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

Update Private Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.updatePrivateNetwork(tenantNetworkId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId}', headers = headers)

print(r.json())

PUT /networks/private/{tenantNetworkId}

Body parameter

{
  "tenantNetworkId": "string",
  "apiKey": "string",
  "blockExplorerUrl": "string",
  "configuration": {
    "symbol": "string",
    "eips": {
      "isEIP1559": true
    },
    "safeContracts": {
      "master": "string",
      "proxyFactory": "string",
      "multisendCallOnly": "string",
      "createCall": "string"
    },
    "subgraphURL": "string"
  },
  "stackResourceId": "string"
}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

Delete Private Network

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };

const client = new Defender(creds);

const result = await client.networks.deletePrivateNetwork(tenantNetworkId);


curl -X DELETE https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId} \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.delete('https://api.defender.openzeppelin.com/v2/networks/private/{tenantNetworkId}', headers = headers)

print(r.json())

DELETE /networks/private/{tenantNetworkId}

Parameters

Name In Type Required Description
tenantNetworkId path string true none

Responses

Status Meaning Description Schema

Relay-signer

List Transactions

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.listTransactions(body);


curl -X GET https://api.defender.openzeppelin.com/v2/txs \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/txs', headers = headers)

print(r.json())

GET /txs

Body parameter

{
  "status": "pending",
  "since": "2019-08-24T14:15:22Z",
  "limit": "string",
  "next": "string",
  "sort": "asc",
  "usePagination": "string"
}

Responses

Status Meaning Description Schema

Send Transaction

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.sendTransaction(body);


curl -X POST https://api.defender.openzeppelin.com/v2/txs \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/txs', headers = headers)

print(r.json())

POST /txs

Body parameter

{
  "to": "string",
  "value": "string",
  "data": "string",
  "validUntil": "2019-08-24T14:15:22Z",
  "gasLimit": "string",
  "speed": "safeLow",
  "gasPrice": "string",
  "maxFeePerGas": "string",
  "maxPriorityFeePerGas": "string",
  "isPrivate": true
}

Responses

Status Meaning Description Schema

Get Transaction

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.getTransaction(txId);


curl -X GET https://api.defender.openzeppelin.com/v2/txs/{txId} \
  -H 'Authorization: $JWT'


import requests
headers = {
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/txs/{txId}', headers = headers)

print(r.json())

GET /txs/{txId}

Parameters

Name In Type Required Description
txId path string true none

Responses

Status Meaning Description Schema

Replace Transaction

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.replaceTransactionById(txId, body);


curl -X PUT https://api.defender.openzeppelin.com/v2/txs/{txId} \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.put('https://api.defender.openzeppelin.com/v2/txs/{txId}', headers = headers)

print(r.json())

PUT /txs/{txId}

Body parameter

{
  "to": "string",
  "value": "string",
  "data": "string",
  "validUntil": "2019-08-24T14:15:22Z",
  "gasLimit": "string",
  "speed": "safeLow",
  "gasPrice": "string",
  "maxFeePerGas": "string",
  "maxPriorityFeePerGas": "string",
  "isPrivate": true
}

Parameters

Name In Type Required Description
txId path string true none

Responses

Status Meaning Description Schema

Sign Transaction

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.sign(body);


curl -X POST https://api.defender.openzeppelin.com/v2/sign \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/sign', headers = headers)

print(r.json())

POST /sign

Body parameter

{
  "message": "string"
}

Responses

Status Meaning Description Schema

Send RPC call

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.call(body);


curl -X POST https://api.defender.openzeppelin.com/v2/relayer/jsonrpc \
  -H 'Content-Type: application/json' \  
  -H 'Authorization: $JWT' \  
  -d $BODY


import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': '$JWT'
}

r = requests.post('https://api.defender.openzeppelin.com/v2/relayer/jsonrpc', headers = headers)

print(r.json())

POST /relayer/jsonrpc

Body parameter

{
  "method": "string",
  "params": [
    {}
  ],
  "id": 0,
  "jsonrpc": "2.0"
}

Responses

Status Meaning Description Schema

Get Status

Code samples


import { Defender } from '@openzeppelin/defender-sdk';

const creds = { relayerApiKey: 'YOUR_RELAYER_API_KEY', relayerApiSecret: 'YOUR_RELAYER_API_SECRET' };

const client = new Defender(creds);

const result = await client.relaySigner.getRelayerStatus();


curl -X GET https://api.defender.openzeppelin.com/v2/relayers/status \
  -H 'Accept: application/json' \  
  -H 'Authorization: $JWT'


import requests
headers = {
  'Accept': 'application/json',
  'Authorization': '$JWT'
}

r = requests.get('https://api.defender.openzeppelin.com/v2/relayers/status', headers = headers)

print(r.json())

GET /relayers/status

Example responses

200 Response

{
  "relayerId": "string",
  "name": "string",
  "nonce": 0,
  "address": "string",
  "numberOfPendingTransactions": 0,
  "paused": true,
  "pendingTxCost": "string",
  "txsQuotaUsage": 0,
  "rpcQuotaUsage": 0,
  "lastConfirmedTransaction": {
    "hash": "string",
    "status": "string",
    "minedAt": "string",
    "sentAt": "string",
    "nonce": 0
  }
}

Responses

Status Meaning Description Schema
200 OK none Inline

Response Schema

See example

Migration guide

Some JavaScript examples for migrating @openzeppelin/defender-client packages to defender-sdk.

The following examples show how to migrate some of the main functionalities using the new client package.

Proposal

// defender-client implementation
const { AdminClient } = require('@openzeppelin/defender-admin-client');

const creds = { apiKey: apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET'  };
const client = new AdminClient(creds);
const proposal = await client.createProposal({ ... });
// defender-sdk implementation
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
const proposal = await client.proposal.create({ ... });

Previously, proposal operations were part of @openzeppelin/defender-admin-client. Now, they can be imported from defender-sdk or directly from @openzeppelin/defender-sdk-proposal-client.

See proposals section to find other operations.

Relay

// defender-client implementation
const { RelayClient } = require('@openzeppelin/defender-relay-client');

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new RelayClient(creds);
const relayer = await client.create({ ... });
// defender-sdk implementation
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
const client = await client.relay.create({ ... });

Previously, proposal operations were part of @openzeppelin/defender-relay-client. Now, they can be imported from defender-sdk or directly from @openzeppelin/defender-sdk-relay-client.

See relay section to find other operations.

Action (Autotask)

// defender-client implementation
const { AutotaskClient } = require('@openzeppelin/defender-autotask-client');

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new AutotaskClient(creds);
const autotask = await client.create({ ... });
}
// defender-sdk implementation
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
const client = await client.action.create({ ... });

Previously, Action operations (formerly known as Autotasks) were part of @openzeppelin/defender-autotask-client. Now, they can be imported from defender-sdk or directly from @openzeppelin/defender-sdk-action-client.

See action section to find other operations.

Monitor (Sentinel)

// defender-client implementation
const { SentinelClient } = require('@openzeppelin/defender-sentinel-client');

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new SentinelClient(creds);
const sentinel = await client.create({ ... }); 
// defender-sdk implementation
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
const client = await client.monitor.create({ ... });

Previously, Monitor operations (formerly known as Sentinels) were part of @openzeppelin/defender-sentinel-client. Now, they can be imported from defender-sdk or directly from @openzeppelin/defender-sdk-monitor-client.

See monitor section to find other operations.

Admin

// defender-client implementation
const { AdminClient } = require('@openzeppelin/defender-admin-client');

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new AdminClient(creds);
const contracts = await client.listContracts(); 
// defender-sdk implementation
import { Defender } from '@openzeppelin/defender-sdk';

const creds = { apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET' };
const client = new Defender(creds);
const contracts = await client.proposals.listContracts();

Previously, Admin operations were part of @openzeppelin/defender-admin-client. Now, they can be imported from defender-sdk. However, operations are distributed among other packages according to the most common use cases.

In this example, we list contracts using proposal package instead.

See admin section to find other operations.