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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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
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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/deployments/{deploymentId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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",
"relayerGroupId": "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"
],
"confirmationsRequired": 0,
"metadata": {
"property1": "string",
"property2": "string"
},
"origin": "SDK"
}
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://defender-api.openzeppelin.com/v2/deployments \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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",
"relayerGroupId": "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"
],
"confirmationsRequired": 0,
"metadata": {
"property1": "string",
"property2": "string"
},
"origin": "SDK"
}
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://defender-api.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://defender-api.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",
"confirmations": 0
},
"relayerId": "string",
"relayerGroupId": "string",
"approvalProcessId": "string",
"createFactoryAddress": "string",
"metadata": {
"property1": "string",
"property2": "string"
},
"origin": "SDK"
}
Example responses
200 Response
{
"deploymentId": "string",
"createdAt": "string",
"contractName": "string",
"contractPath": "string",
"network": "mainnet",
"relayerId": "string",
"relayerGroupId": "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"
],
"confirmationsRequired": 0,
"metadata": {
"property1": "string",
"property2": "string"
},
"origin": "SDK"
}
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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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 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://defender-api.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://defender-api.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://defender-api.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://defender-api.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",
"isManualInput": true
},
"relayerId": "string",
"relayerGroupId": "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://defender-api.openzeppelin.com/v2/proposals \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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",
"isManualInput": true
},
"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://defender-api.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://defender-api.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://defender-api.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://defender-api.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",
"isManualInput": true
},
"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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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
{
"summary": {
"network": "string",
"blockNumber": 0,
"totalCalls": 0,
"cummulativeGasUsed": 0,
"reverted": true,
"result": "string",
"revertReason": "string",
"events": [
{
"address": "string",
"name": "string",
"signature": "string",
"topics": [
"string"
],
"args": [
{
"value": "string",
"name": "string",
"indexed": true,
"type": "string"
}
]
}
],
"contractStates": [
{
"address": "string",
"states": {
"property1": {
"types": [
"string"
],
"pre": "string",
"post": "string",
"changed": true
},
"property2": {
"types": [
"string"
],
"pre": "string",
"post": "string",
"changed": true
}
}
}
],
"states": [
{
"address": "string",
"key": "string",
"pre": "string",
"post": "string",
"changed": true
}
],
"transfers": [
{
"type": "CALL",
"data": "string",
"from": "string",
"to": "string",
"gas": "string",
"gasPrice": "string",
"value": "string",
"nonce": "string",
"blockNumber": "string",
"description": {}
}
]
},
"records": [
{
"index": 0,
"transaction": {
"type": "CALL",
"data": "string",
"from": "string",
"to": "string",
"gas": "string",
"gasPrice": "string",
"value": "string",
"nonce": "string",
"blockNumber": "string",
"description": {}
},
"events": [
{
"address": "string",
"name": "string",
"signature": "string",
"topics": [
"string"
],
"args": [
{
"value": "string",
"name": "string",
"indexed": true,
"type": "string"
}
]
}
],
"states": [
{
"address": "string",
"key": "string",
"pre": "string",
"post": "string",
"changed": true
}
],
"status": {
"reverted": true,
"gasUsed": "string",
"returnValue": "string"
},
"revertReason": "string"
}
],
"contractProposalId": "string",
"createdAt": "2019-08-24T14:15:22Z",
"error": "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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/relayers/summary \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/relayers/{relayerId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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",
"expiresAt": "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://defender-api.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://defender-api.openzeppelin.com/v2/relayers/{relayerId}/keys', headers = headers)
print(r.json())
POST /relayers/{relayerId}/keys
Body parameter
{
"stackResourceId": "string",
"expiresAt": "string"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| relayerId | path | string | true | none |
Example responses
200 Response
{
"stackResourceId": "string",
"expiresAt": "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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/actions/{actionId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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,
"frequencySeconds": 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://defender-api.openzeppelin.com/v2/actions/{actionId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.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://defender-api.openzeppelin.com/v2/actions \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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,
"frequencySeconds": 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://defender-api.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://defender-api.openzeppelin.com/v2/actions', headers = headers)
print(r.json())
PUT /actions
Body parameter
{
"autotaskId": "string",
"actionId": "string",
"name": "string",
"encodedZippedCode": "string",
"relayerId": "string",
"relayerGroupId": "string",
"trigger": {
"type": "schedule",
"frequencyMinutes": 0,
"frequencySeconds": 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://defender-api.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://defender-api.openzeppelin.com/v2/actions', headers = headers)
print(r.json())
POST /actions
Body parameter
{
"name": "string",
"encodedZippedCode": "string",
"relayerId": "string",
"relayerGroupId": "string",
"trigger": {
"type": "schedule",
"frequencyMinutes": 0,
"frequencySeconds": 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://defender-api.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://defender-api.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,
"frequencySeconds": 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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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,
"frequencySeconds": 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://defender-api.openzeppelin.com/v2/blockwatchers \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/monitors/{monitorId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"type": "FORTA",
"riskCategory": "NONE",
"scenarioId": "string",
"templateId": "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://defender-api.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://defender-api.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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"network": "mainnet",
"type": "FORTA",
"riskCategory": "NONE",
"stackResourceId": "string",
"scenarioId": "string",
"templateId": "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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"type": "FORTA",
"riskCategory": "NONE",
"scenarioId": "string",
"templateId": "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://defender-api.openzeppelin.com/v2/monitors/{monitorId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.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://defender-api.openzeppelin.com/v2/monitors \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"type": "FORTA",
"riskCategory": "NONE",
"scenarioId": "string",
"templateId": "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://defender-api.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://defender-api.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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"network": "mainnet",
"type": "FORTA",
"riskCategory": "NONE",
"stackResourceId": "string",
"scenarioId": "string",
"templateId": "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"
},
"actionCondition": {
"actionId": "string"
},
"address": "string",
"addresses": [
"string"
],
"abi": "string"
}
],
"fortaRule": {
"addresses": [
"string"
],
"agentIDs": [
"string"
],
"conditions": {
"alertIDs": [
"string"
],
"minimumScannerCount": 0,
"severity": 0
},
"autotaskCondition": {
"autotaskId": "string"
},
"actionCondition": {
"actionId": "string"
}
},
"privateFortaNodeId": "string",
"fortaLastProcessedTime": "2019-08-24T14:15:22Z",
"alertThreshold": {
"amount": 0,
"windowSeconds": 0
},
"notifyConfig": {
"notifications": [],
"severityLevel": "LOW",
"autotaskId": "string",
"actionId": "string",
"messageSubject": "string",
"messageBody": "string",
"timeoutMs": 0
},
"type": "FORTA",
"riskCategory": "NONE",
"scenarioId": "string",
"templateId": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
See example
Notification
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://defender-api.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://defender-api.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",
"deliveryFailureNotificationSentAt": "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://defender-api.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://defender-api.openzeppelin.com/v2/notifications/{type}/{notificationId}', headers = headers)
print(r.json())
PUT /notifications/{type}/{notificationId}
Body parameter
{
"name": "string",
"config": {
"url": "http://example.com",
"secret": "string"
},
"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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/notifications \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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",
"deliveryFailureNotificationSentAt": "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://defender-api.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://defender-api.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 |
|---|
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://defender-api.openzeppelin.com/v2/contracts/{contractId} \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.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://defender-api.openzeppelin.com/v2/secrets \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.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
Create Approval Process
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.approvalProcess.create(body);
curl -X POST https://defender-api.openzeppelin.com/v2/approval-process \
-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://defender-api.openzeppelin.com/v2/approval-process', headers = headers)
print(r.json())
POST /approval-process
Body parameter
{
"name": "string",
"component": [
"deploy"
],
"network": "mainnet",
"via": "string",
"viaType": "EOA",
"timelock": {
"address": "string",
"delay": "string"
},
"multisigSender": "string",
"fireblocks": {
"apiKeyId": "string",
"vaultId": "string",
"assetId": "string",
"isManualInput": true
},
"relayerId": "string",
"relayerGroupId": "string",
"stackResourceId": "string"
}
Example responses
200 Response
{
"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",
"isManualInput": true
},
"relayerId": "string",
"relayerGroupId": "string",
"stackResourceId": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
See example
List Approval Process
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./approval-processGET();
curl -X GET https://defender-api.openzeppelin.com/v2/approval-process \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.openzeppelin.com/v2/approval-process', headers = headers)
print(r.json())
GET /approval-process
Example responses
200 Response
{
"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",
"isManualInput": true
},
"relayerId": "string",
"relayerGroupId": "string",
"stackResourceId": "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://defender-api.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://defender-api.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
{
"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",
"isManualInput": true
},
"relayerId": "string",
"relayerGroupId": "string",
"stackResourceId": "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://defender-api.openzeppelin.com/v2/contracts \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/contracts', headers = headers)
print(r.json())
PUT /contracts
Body parameter
{
"contractId": "string",
"name": "string",
"abi": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|
List Address Book
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.addressBook.list();
curl -X GET https://defender-api.openzeppelin.com/v2/address-book \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.openzeppelin.com/v2/address-book', headers = headers)
print(r.json())
GET /address-book
Example responses
200 Response
{
"address": "string",
"network": "mainnet",
"type": "EOA",
"alias": "string",
"symbol": "string",
"decimals": 0,
"addressBookId": "string",
"createdAt": "string",
"updatedAt": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
See example
Create Address Book
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.addressBook.create(body);
curl -X POST https://defender-api.openzeppelin.com/v2/address-book \
-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://defender-api.openzeppelin.com/v2/address-book', headers = headers)
print(r.json())
POST /address-book
Body parameter
{
"address": "string",
"network": "mainnet",
"type": "EOA",
"alias": "string",
"symbol": "string",
"decimals": 0
}
Example responses
200 Response
{
"address": "string",
"network": "mainnet",
"type": "EOA",
"alias": "string",
"symbol": "string",
"decimals": 0,
"addressBookId": "string",
"createdAt": "string",
"updatedAt": "string"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
See example
Delete Address Book entry
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.addressBook.delete(addressBookId);
curl -X DELETE https://defender-api.openzeppelin.com/v2/address-book/{addressBookId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.openzeppelin.com/v2/address-book/{addressBookId}', headers = headers)
print(r.json())
DELETE /address-book/{addressBookId}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| addressBookId | path | string | true | none |
Responses
| Status | Meaning | Description | Schema |
|---|
List Api Key Capabilities
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./api-keys/{apiKey}/capabilitiesGET(apiKey);
curl -X GET https://defender-api.openzeppelin.com/v2/api-keys/{apiKey}/capabilities \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.openzeppelin.com/v2/api-keys/{apiKey}/capabilities', headers = headers)
print(r.json())
GET /api-keys/{apiKey}/capabilities
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| apiKey | path | string | true | none |
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://defender-api.openzeppelin.com/v2/networks \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.network.listForkedNetworks();
curl -X GET https://defender-api.openzeppelin.com/v2/networks/fork \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.network.createForkedNetwork(body);
curl -X POST https://defender-api.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://defender-api.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",
"isProduction": true,
"configuration": {
"symbol": "string",
"eips": {
"isEIP1559": true
},
"safeContracts": {
"master": "string",
"proxyFactory": "string",
"multisendCallOnly": "string",
"createCall": "string"
},
"subgraphURL": "string",
"safeTxServiceURL": "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.network.getForkedNetwork(tenantNetworkId);
curl -X GET https://defender-api.openzeppelin.com/v2/networks/fork/{tenantNetworkId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.network.updateForkedNetwork(tenantNetworkId, body);
curl -X PUT https://defender-api.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://defender-api.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.network.deleteForkedNetwork(tenantNetworkId);
curl -X DELETE https://defender-api.openzeppelin.com/v2/networks/fork/{tenantNetworkId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.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.network.listPrivateNetworks();
curl -X GET https://defender-api.openzeppelin.com/v2/networks/private \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.network.createPrivateNetwork(body);
curl -X POST https://defender-api.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://defender-api.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",
"safeTxServiceURL": "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",
"isProduction": true,
"configuration": {
"symbol": "string",
"eips": {
"isEIP1559": true
},
"safeContracts": {
"master": "string",
"proxyFactory": "string",
"multisendCallOnly": "string",
"createCall": "string"
},
"subgraphURL": "string",
"safeTxServiceURL": "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.network.getPrivateNetwork(tenantNetworkId);
curl -X GET https://defender-api.openzeppelin.com/v2/networks/private/{tenantNetworkId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.network.updatePrivateNetwork(tenantNetworkId, body);
curl -X PUT https://defender-api.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://defender-api.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",
"safeTxServiceURL": "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.network.deletePrivateNetwork(tenantNetworkId);
curl -X DELETE https://defender-api.openzeppelin.com/v2/networks/private/{tenantNetworkId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.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,
"privateMode": "flashbots-normal"
}
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://defender-api.openzeppelin.com/v2/txs/{txId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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://defender-api.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://defender-api.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,
"privateMode": "flashbots-normal"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| txId | path | string | true | none |
Responses
| Status | Meaning | Description | Schema |
|---|
Cancel 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.cancelTransactionById(txId);
curl -X DELETE https://defender-api.openzeppelin.com/v2/txs/{txId} \
-H 'Authorization: $JWT'
import requests
headers = {
'Authorization': '$JWT'
}
r = requests.delete('https://defender-api.openzeppelin.com/v2/txs/{txId}', headers = headers)
print(r.json())
DELETE /txs/{txId}
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://defender-api.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://defender-api.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://defender-api.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://defender-api.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://defender-api.openzeppelin.com/v2/relayers/status \
-H 'Accept: application/json' \
-H 'Authorization: $JWT'
import requests
headers = {
'Accept': 'application/json',
'Authorization': '$JWT'
}
r = requests.get('https://defender-api.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.