Repository navigation
Conversation
Adds a self-contained XNO amount type alongside the existing USDC primitives in packages/sdk/src/types.ts: - XnoAmount - 30-decimal bigint interface (mirrors UsdcAmount) - XNO_DECIMALS = 30 - Nano native raw precision - xno(human) - decimal-string parser, exact down to a single raw - formatXno(amount) - renders back to a trimmed human string - NANO_NETWORK = "nano:mainnet" - CAIP-2 chain id for x402 accepts Already exported via export * from "./types.js" in index.ts. No new dependencies. All 9 monorepo packages build and typecheck clean.
Collaborator
|
Hi, thanks for the PR and for the clear write-up :) One thing in the motivation is not right - Also, AgenticPay settles on Solana with USDC only, and adding a new network is a product decision we are not making right now. Amount helpers without a facilitator and client flow behind them would be dead code in the SDK, so I will close this one. If we decide to add another network later, I will open an issue first so we can discuss it there. Thanks again 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Nano (XNO) amount primitives to
@agenticpay/sdk: anXnoAmounttype with exact decimal-string construction (xno()), a formatter (formatXno), and the associated constants (XNO_DECIMALS = 30,NANO_NETWORK = "nano:mainnet").This is a pure leaf addition mirroring the existing
UsdcAmount/usdc()/formatUsdc()pattern intypes.ts. It has no runtime dependencies and changes no existing behaviour.Why Nano — This SDK's own cheapest product prices at $0.0005 per call. A 6-decimal token (USDC's base unit) rounds that amount to zero raw at the point of settlement. Nano (XNO) has 30 native decimals, so a $0.0005 charge is exactly representable (
5e26raw) and settles at its true value with no gas/no fee. These primitives are the amount layer a Nano settlement option would need.Changes
packages/sdk/src/types.ts— new types + functions appended after the existing USDC helpersAlready exported via
export * from "./types.js"inpackages/sdk/src/index.ts.Test plan
Build + typecheck pass for all 9 monorepo packages (
pnpm -r build && pnpm -r typecheck).Exactness verified manually:
Backwards compatibility
Security