aligned
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Aligned-JS

Aligned-js is a JavaScript library for interacting with the Aligned layer.

SDK API Reference

submit

Submits a proof to the batcher to be verified and returns an aligned verification data struct.

import { submit, Network } from "aligned";

async function main() {
    const alignedData = await submit(
        "BATCHER_URL",
        "NETWORK.NAME",
        "VerificationData",
        "MAX_FEE",
        "WALLET_ACCOUNT",
        "NONCE"
    );
    console.log(alignedData);
}

submitMultiple

Submits multiple proofs to the batcher to be verified and returns an aligned verification data array.

import { submitMultiple, Network } from "aligned";

async function main() {
    const alignedData = await submitMultiple(
        "BATCHER_URL",
        "NETWORK.NAME",
        "VerificationData",
        "MAX_FEE",
        "WALLET_ACCOUNT",
        "NONCE"
    );
    console.log(alignedData);
}

submitAndWaitVerification

Submits a proof to the batcher to be verified, waits for the verification on ethereum and returns an aligned verification data struct.

import { submitAndWaitVerification, Network } from "aligned";

async function main() {
    const alignedData = await submitAndWaitVerification(
        "BATCHER_URL",
        "ETH_RPC_API",
        "NETWORK.NAME",
        "VerificationData",
        "MAX_FEE",
        "WALLET_ACCOUNT",
        "NONCE"
    );
    console.log(alignedData);
}

isProofVerified

Checks if the proof has been verified with Aligned and is included in the batch on-chain.

import { isProofVerified, Network } from "aligned";

async function main() {
    const verified = await isProofVerified(
        "alignedVerificationData",
        "NETWORK.NAME",
        "ETH_RPC_API"
    );
    console.log(verified);
}

getNextNonce

Returns the nonce to use for a given address.

import { getNextNonce, Network } from "aligned";

async function main() {
    const nonce = await getNextNonce(
        "ETH_RPC_API",
        "ADDRESS",
        "NETWORK.NAME",
    );
    console.log(nonce);
}

getBalanceInAligned

Queries a User's balance that was deposited in Aligned

import { getBalanceInAligned, Network } from "aligned";

async function main() {
    const balance = await getNextNonce(
        "ADDRESS",
        "ETH_RPC_API",
        "NETWORK.NAME",
    );
    console.log(balance);
}

✏️ Contributing

If you consider to contribute to this project please read CONTRIBUTING.md first.

📜 License

Copyright (c) 2024 Broly Labs

Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i aligned

Weekly Downloads

5

Version

0.1.0

License

ISC

Unpacked Size

572 kB

Total Files

35

Last publish

Collaborators

  • khairallah_alawady