Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
brahma-templates-sdk-beta
Advanced tools
The `brahma-templates-sdk` is a powerful tool designed to facilitate interaction with Brahma. It provides a set of functions to manage transactions efficiently.
The brahma-templates-sdk
is a powerful tool designed to facilitate interaction with Brahma. It provides a set of functions to manage transactions efficiently.
To install the SDK, use npm or yarn:
npm install brahma-templates-sdk
or
yarn add brahma-templates-sdk
The SDK is structured into three main components, each handling specific functionalities:
Responsible for fetching automation logs and subscriptions. Utilizes HTTP GET requests to interact with the Brahma backend.
fetchAutomationLogs(automationId: string): Promise<AutomationLogResponse[]>
automationId
: A string representing the unique ID of the automation.Promise
that resolves to an array of AutomationLogResponse
objects.fetchAutomationSubscriptions(accountAddress: Address, chainId: number): Promise<AutomationSubscription[]>
accountAddress
: The address of the account (Address
type).chainId
: The blockchain network ID (number
type).Promise
that resolves to an array of AutomationSubscription
objects.Manages transaction building and automation operations. Communicates with a parent iFrame using a Communicator
interface.
addToTxnBuilder(params: BuilderParams, automationName: string): Promise<void>
params
: An object of type BuilderParams
containing:
transactions
: An array of Transaction
objects, each with:
toAddress
: The address to send the transaction to.callData
: The calldata for the transaction.value
: The value to send with the transaction.automationName
: A string representing the name of the automation.Promise
that resolves to void
.addAutomation(params: AddAutomationParams): Promise<void>
params
: An object of type AddAutomationParams
.Promise
that resolves to void
.cancelAutomation(params: CancelAutomationParams): Promise<void>
params
: An object of type CancelAutomationParams
.Promise
that resolves to void
.Handles the deployment of new Brahma Accounts and related operations. Makes HTTP POST requests to deploy accounts and manage user strategies.
fetchPreComputeAddress(owner: Address, chainId: number, feeToken: Address): Promise<PreComputedAddressData | null>
owner
: The address of the owner (Address
type).chainId
: The blockchain network ID (number
type).feeToken
: The address of the fee token (Address
type).Promise
that resolves to PreComputedAddressData
or null
.generateAutomationSubAccount(owner: Address, precomputedConsoleAddress: Address, chainID: number, registryID: string, feeToken: Address, feeEstimate: string, tokens: Address[], amounts: string[], automationSubscriptionLimits: AutomationSubscriptionLimits): Promise<TransferCalldataResponse | null>
Promise
that resolves to TransferCalldataResponse
or null
.deployBrahmaAccount(owner: Address, chainID: number, registryID: string, subscriptionDraftID: string, subAccountPolicyCommit: string, feeToken: Address, tokens: Address[], amounts: string[], subAccountChainerSignature: string, feeEstimateSignature: string, feeEstimate: string, metadata: Record<string, unknown>): Promise<{ taskId: string } | null>
Promise
that resolves to an object containing taskId
or null
.fetchDeploymentStatus(taskId: string): Promise<TaskStatusData>
taskId
: The ID of the task (string
type).Promise
that resolves to TaskStatusData
.Checkout the Drain-Account Example Template here
Here's a basic example of how to use the SDK in a React component:
import React, { useState } from 'react';
import { TemplatesSDK } from 'brahma-templates-sdk';
const sdk = new TemplatesSDK('your-api-key');
export default function Template() {
const [value, setValue] = useState(false);
// Example usage of getClientFactory
const fetchClientFactory = async () => {
try {
const clientFactory = await sdk.getClientFactory();
console.log(clientFactory);
} catch (error) {
console.error("Error fetching client factory:", error);
}
};
// Example usage of addToTxnBuilder
const addTransaction = async () => {
try {
const params = {
transactions: [
{
toAddress: "0x123...",
callData: "0xabc...",
value: BigInt(1000),
},
{
toAddress: "0x456...",
callData: "0xdef...",
value: BigInt(2000),
}
],
};
await sdk.builderCaller.addToTxnBuilder(params, "MyAutomation");
} catch (error) {
console.error("Error adding to transaction builder:", error);
}
};
return (
<div>
<button onClick={fetchClientFactory}>Fetch Client Factory</button>
<button onClick={addTransaction}>Add Transaction</button>
</div>
);
}
This project is licensed under the MIT License.
FAQs
The `brahma-templates-sdk` is a powerful tool designed to facilitate interaction with Brahma. It provides a set of functions to manage transactions efficiently.
We found that brahma-templates-sdk-beta demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.