All URIs are relative to https://developers.fireblocks.com/reference/
Method | HTTP request | Description |
---|---|---|
getDeployedContractAbi | GET /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions | Return deployed contract's ABI |
getTransactionReceipt | GET /contract_interactions/base_asset_id/{baseAssetId}/tx_hash/{txHash}/receipt | Get transaction receipt |
readCallFunction | POST /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/read | Call a read function on a deployed contract |
writeCallFunction | POST /contract_interactions/base_asset_id/{baseAssetId}/contract_address/{contractAddress}/functions/write | Call a write function on a deployed contract |
ContractAbiResponseDto getDeployedContractAbi()
Return deployed contract's ABI by blockchain native asset id and contract address
import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ContractInteractionsApiGetDeployedContractAbiRequest, ContractAbiResponseDto } from '@fireblocks/ts-sdk';
// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");
const fireblocks = new Fireblocks();
let body: ContractInteractionsApiGetDeployedContractAbiRequest = {
// string | The contract\'s onchain address
contractAddress: 0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66,
// string
baseAssetId: baseAssetId_example,
// string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
idempotencyKey: idempotencyKey_example,
};
fireblocks.contractInteractions.getDeployedContractAbi(body).then((res: FireblocksResponse<ContractAbiResponseDto>) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
contractAddress | [string] | The contract's onchain address | defaults to undefined |
baseAssetId | [string] | defaults to undefined | |
idempotencyKey | [string] | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. | (optional) defaults to undefined |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | - | |
0 | Error Response | * X-Request-ID - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TransactionReceiptResponse getTransactionReceipt()
Retrieve the transaction receipt by blockchain native asset ID and transaction hash
import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ContractInteractionsApiGetTransactionReceiptRequest, TransactionReceiptResponse } from '@fireblocks/ts-sdk';
// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");
const fireblocks = new Fireblocks();
let body: ContractInteractionsApiGetTransactionReceiptRequest = {
// string | The blockchain base assetId
baseAssetId: ETH_TEST6,
// string | The transaction hash
txHash: 0x3b015ca0518c55d7bff4e3f5aa5d0431705771553ba8a95cf20e34cb597f57f6,
};
fireblocks.contractInteractions.getTransactionReceipt(body).then((res: FireblocksResponse<TransactionReceiptResponse>) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
baseAssetId | [string] | The blockchain base assetId | defaults to undefined |
txHash | [string] | The transaction hash | defaults to undefined |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Retrieved The Transaction Receipt Successfully | - |
0 | Error Response | * X-Request-ID - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ParameterWithValueList readCallFunction(readCallFunctionDto, )
Call a read function on a deployed contract by blockchain native asset id and contract address
import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ContractInteractionsApiReadCallFunctionRequest, ParameterWithValueList } from '@fireblocks/ts-sdk';
// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");
const fireblocks = new Fireblocks();
let body: ContractInteractionsApiReadCallFunctionRequest = {
// ReadCallFunctionDto
readCallFunctionDto: param_value,
// string | The contract\'s onchain address
contractAddress: 0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66,
// string
baseAssetId: baseAssetId_example,
// string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
idempotencyKey: idempotencyKey_example,
};
fireblocks.contractInteractions.readCallFunction(body).then((res: FireblocksResponse<ParameterWithValueList>) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
readCallFunctionDto | ReadCallFunctionDto | ||
contractAddress | [string] | The contract's onchain address | defaults to undefined |
baseAssetId | [string] | defaults to undefined | |
idempotencyKey | [string] | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. | (optional) defaults to undefined |
No authorization required
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Read Call Retrieved Successfully | - |
0 | Error Response | * X-Request-ID - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
WriteCallFunctionResponseDto writeCallFunction(writeCallFunctionDto, )
Call a write function on a deployed contract by blockchain native asset id and contract address. This creates an onchain transaction, thus it is an async operation. It returns a transaction id that can be polled for status check
import { readFileSync } from 'fs';
import { Fireblocks, BasePath } from '@fireblocks/ts-sdk';
import type { FireblocksResponse, ContractInteractionsApiWriteCallFunctionRequest, WriteCallFunctionResponseDto } from '@fireblocks/ts-sdk';
// Set the environment variables for authentication
process.env.FIREBLOCKS_BASE_PATH = BasePath.Sandbox; // or assign directly to "https://sandbox-api.fireblocks.io/v1"
process.env.FIREBLOCKS_API_KEY = "my-api-key";
process.env.FIREBLOCKS_SECRET_KEY = readFileSync("./fireblocks_secret.key", "utf8");
const fireblocks = new Fireblocks();
let body: ContractInteractionsApiWriteCallFunctionRequest = {
// WriteCallFunctionDto
writeCallFunctionDto: param_value,
// string | The contract\'s onchain address
contractAddress: 0xC2c4e1Db41F0bB97996D0eD0542D2170d146FB66,
// string
baseAssetId: baseAssetId_example,
// string | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
idempotencyKey: idempotencyKey_example,
};
fireblocks.contractInteractions.writeCallFunction(body).then((res: FireblocksResponse<WriteCallFunctionResponseDto>) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(res, null, 2));
}).catch((error:any) => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
writeCallFunctionDto | WriteCallFunctionDto | ||
contractAddress | [string] | The contract's onchain address | defaults to undefined |
baseAssetId | [string] | defaults to undefined | |
idempotencyKey | [string] | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. | (optional) defaults to undefined |
No authorization required
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
202 | - | |
0 | Error Response | * X-Request-ID - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]