Skip to content

feat: support for aptos#482

Open
frolvanya wants to merge 2 commits into
mainfrom
feat/aptos
Open

feat: support for aptos#482
frolvanya wants to merge 2 commits into
mainfrom
feat/aptos

Conversation

@frolvanya

@frolvanya frolvanya commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Adds Aptos as a supported chain, ported from the reference implementations in
Near-One/bridge-sdk-rs#294 (Rust SDK) and Near-One/omni-bridge#626 (Move locker).

New package: @omni-bridge/aptos

  • createAptosBuilder({ network, bridgeAddress? }) builds entry-function payloads
    for the omni_bridge Move package: buildTransfer (init_transfer — no approval
    step, the contract pulls from the signer), buildLogMetadata, buildDeployToken,
    and buildFinalization (fin_transfer from a NEAR SignTransferEvent, 65-byte MPC
    signature split into rs/v).
  • Payloads are plain objects compatible with InputEntryFunctionData from
    @aptos-labs/ts-sdk — pass directly to aptos.transaction.build.simple() or a
    wallet adapter. Verified against ts-sdk v7.1.0: every argument converts to the
    exact BCS bytes the Move contract expects (addresses as canonical 64-hex strings,
    u64/u128 as decimal strings, vector as byte arrays, Option None as null).
  • Event helpers over the fullnode REST API for relayers / MPC proof construction
    (getAptosInitTransferLog etc. with canonical sorted-key JSON data),
    isAptosTransferFinalised, and offline derivation of the bridge state object and
    bridged-token FA addresses.

Core wiring

  • ChainKind.Aptos = 13 (matches the Rust omni_types borsh discriminant), aptos:
    OmniAddress prefix (32-byte hex, short forms zero-padded), API schemas for the
    "Aptos" chain and its transaction shape, aptos- NEAR token prefix.
  • NEAR storage borsh schema: Aptos variant (32 bytes, left-padded like Starknet).
  • Native APT is the Fungible Asset at 0xa; Aptos decimals cap at 8 (FA amounts
    are u64).
  • The bridge contract is not yet deployed, so no address ships in config:
    validateTransfer throws UNSUPPORTED_CHAIN for Aptos sources and the builder
    requires an explicit bridgeAddress until then.

Docs & tests

  • New guide (docs/guides/aptos.mdx) and API reference (docs/reference/aptos.mdx),
    chain lists updated across README/docs, package README, changeset.
  • Unit tests for builder payloads, address/encoding utilities (ground-truth vectors
    generated with @aptos-labs/ts-sdk), event parsing, borsh discriminants, and
    storage account derivation. 341 tests pass; build/typecheck/lint clean.

Misc

  • Adds the Claude Code PR review workflow (same setup as bridge-sdk-rs and
    bridge-indexer: pinned claude-code-action, ANTHROPIC_API org secret, repo-specific
    review prompt).

@frolvanya frolvanya requested review from a team as code owners June 11, 2026 18:37
@frolvanya frolvanya requested a review from Copilot June 11, 2026 18:37
@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 190a942

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@omni-bridge/core Minor
@omni-bridge/near Minor
@omni-bridge/aptos Minor
@omni-bridge/sdk Minor
@omni-bridge/btc Minor
@omni-bridge/evm Minor
@omni-bridge/solana Minor
@omni-bridge/starknet Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class Aptos support to the Omni Bridge SDK by introducing a new @omni-bridge/aptos package (payload builder + event/log helpers) and wiring the new chain through the core SDK types/config/API schemas and NEAR-side storage-account borsh serialization. It also updates the umbrella @omni-bridge/sdk package and documentation to expose and describe the new chain.

Changes:

  • Add @omni-bridge/aptos package with builder (init_transfer, log_metadata, deploy_token, fin_transfer), encoding utilities, and Aptos fullnode event helpers + tests.
  • Thread ChainKind.Aptos / aptos: OmniAddress support through core (types, address + token utils, bridge contract resolution, API zod schemas) and NEAR storage borsh address parsing (incl. short-form zero-padding parity).
  • Update SDK exports, monorepo refs/changesets, and docs (guides + reference) to include Aptos; add a GitHub workflow/scripts for Claude-based PR review context.

Reviewed changes

Copilot reviewed 41 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tsconfig.json Add packages/aptos as a TS project reference in the monorepo build.
README.md Mention Aptos in supported chains, OmniAddress examples, and packages list.
packages/sdk/tsconfig.json Reference the new Aptos package from the umbrella SDK project.
packages/sdk/src/index.ts Re-export @omni-bridge/aptos from @omni-bridge/sdk.
packages/sdk/package.json Add @omni-bridge/aptos as a workspace dependency.
packages/near/tests/storage.test.ts Add coverage for Aptos short-form vs padded address serialization parity.
packages/near/tests/chain-kind-schema.test.ts Lock the new ChainKind.Aptos borsh discriminant byte (append-only).
packages/near/src/storage.ts Extend NEAR storage-account borsh schema/address parsing to include Aptos (32-byte padded hex).
packages/core/tests/token.test.ts Test aptos- wrapped-token prefix parsing maps to ChainKind.Aptos.
packages/core/tests/bridge.test.ts Validate NEAR→Aptos flow + ensure Aptos as source errors as unsupported until deployed.
packages/core/tests/api.test.ts Add a transfer parsing test for an Aptos transaction variant payload.
packages/core/tests/address.test.ts Add Aptos OmniAddress construction/parsing and isEvmChain classification check.
packages/core/src/utils/token.ts Add "aptos-" prefix mapping for wrapped-token origin-chain inference.
packages/core/src/utils/address.ts Add aptos prefix ↔ ChainKind.Aptos mappings.
packages/core/src/types.ts Add ChainKind.Aptos, aptos: OmniAddress variant, and ChainPrefix member.
packages/core/src/index.ts Export the new AptosAddresses type from config via core’s public index.
packages/core/src/config.ts Introduce AptosAddresses and optional aptos?: in ChainAddresses.
packages/core/src/bridge.ts Wire Aptos into API chain-name mapping and contract-address resolution (gated until deployed).
packages/core/src/api.ts Add "Aptos" to API chain enum + add Aptos transaction variant schema.
packages/aptos/tsconfig.json New TS project config for the Aptos package (composite build, references core).
packages/aptos/tests/events.test.ts Test Aptos event log extraction/parsing, hash validation, and view call behavior.
packages/aptos/tests/encoding.test.ts Test address normalization/bytes conversion, signature splitting, object address derivation, event-data canonicalization.
packages/aptos/tests/builder.test.ts Test payload argument ordering and encoding conventions for all builder methods.
packages/aptos/src/index.ts Public exports for builder/encoding/events with Aptos-prefixed helper names.
packages/aptos/src/events.ts Implement Aptos fullnode REST transaction fetching + bridge event extraction/parsing helpers.
packages/aptos/src/encoding.ts Implement Aptos address normalization, signature splitting, UTF-8 helpers, and named-object address derivation.
packages/aptos/src/builder.ts Implement createAptosBuilder and payload construction for Move entry functions.
packages/aptos/README.md Package-level documentation and usage examples for the Aptos builder/helpers.
packages/aptos/package.json Define the new @omni-bridge/aptos package metadata and dependencies.
docs/reference/core.mdx Update core reference docs to include fogo + aptos OmniAddress/ChainKind/ChainPrefix/Chain docs and config types.
docs/reference/aptos.mdx Add full reference docs for the new @omni-bridge/aptos API surface.
docs/introduction.mdx Add Aptos to the chain cards and package list.
docs/guides/aptos.mdx Add an Aptos guide describing validate-then-build flow and Aptos-specific mechanics.
docs/getting-started.mdx Add Aptos to the “pick your source chain” guide cards.
docs/docs.json Add Aptos guide/reference pages to docs navigation and update docs description.
docs/core-concepts/omni-addresses.mdx Document aptos: OmniAddress prefix and APT native token representation details.
CLAUDE.md Update repo structure and builder pattern documentation to include Aptos.
bun.lock Add @omni-bridge/aptos workspace entry and SDK dependency link.
.github/workflows/claude-pr-review.yml Add workflow to run Claude-based code review on PR events / mentions.
.github/scripts/fetch-pr-comments.sh Add helper script to fetch PR comment/review-thread context via GraphQL.
.github/prompts/pr-review.prompt.md Add TypeScript PR review prompt used by the Claude review workflow (includes Aptos).
.changeset/curly-eyes-search.md Changeset for Aptos support across core/near/aptos/sdk packages.
.changeset/config.json Add @omni-bridge/aptos to the fixed changeset group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants