Skip to content

Conversation

@paullinator
Copy link
Member

@paullinator paullinator commented Oct 14, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Introduces guidance and scaffolding for new exchange integrations and streamlines chain mapping.

  • Docs: Adds API_REQUIREMENTS.md, CHAIN_MAPPING_SYNCHRONIZERS.md, and CREATING_AN_EXCHANGE_PLUGIN.md outlining provider specs, mapping sync, and plugin creation
  • Template plugin: New src/swap/central/template.ts with full quote flow, error handling, EVM handling, and spend construction
  • Synchronizer refactor: Central registry scripts/allSynchronizers.ts; all provider synchronizers now use util/loadMappingFile.ts (getMappingFilePath/loadMappingFile) and expose a consistent NAME
  • mapctl: Uses central registry; improves sync/update/add-plugin flows and generated mapping outputs/comments
  • Swap helpers: Adds nativeToDenomination, denominationToNative, getContractAddresses, and getCurrencyMultiplier; imports div/mul; minor typings
  • Deps: Bumps edge-currency-accountbased, edge-currency-plugins, and typescript

Written by Cursor Bugbot for commit 33f9afe. This will update automatically on new commits. Configure here.



const token = allTokens[tokenId]
return token.denominations[0].multiplier
}
Copy link

Choose a reason for hiding this comment

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

Bug: Token Existence Validation Missing

The getCurrencyMultiplier and getContractAddresses functions don't check if a token exists in allTokens before attempting to access its properties (like denominations or networkLocation). This can lead to runtime errors if allTokens[tokenId] returns undefined.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

Not an issue since it's the core that provides the tokenId and so we can be sure that allTokens includes the tokenId

const { currencyConfig } = wallet
const { allTokens } = currencyConfig
const multiplier = getCurrencyMultiplier(currencyInfo, allTokens, tokenId)
return div(nativeAmount, multiplier, multiplier.length)
Copy link

Choose a reason for hiding this comment

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

Bug: Precision Error in Denomination Conversion

In nativeToDenomination, the div function's precision parameter is incorrectly set to multiplier.length. This uses the string length of the multiplier instead of its actual decimal precision, which can lead to inaccurate conversion results.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

multiplier is actually a good estimate for precision as the multiplier is a power of 10 and determines how many decimal places the denomination can have.

@paullinator paullinator force-pushed the paul/apiReq branch 3 times, most recently from a36e55d to c3b08f6 Compare November 27, 2025 05:38
@paullinator paullinator force-pushed the paul/apiReq branch 3 times, most recently from 2683df8 to 357c9d2 Compare December 19, 2025 02:11
Copy link
Contributor

@samholmes samholmes left a comment

Choose a reason for hiding this comment

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

I've update the PR as part of my review. I'm setting request changes to mean that I'm requesting you accept the changes I added.

@@ -0,0 +1,145 @@
# Edge Exchange Provider API Requirements
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add a paragraph immediately after the document title that gives a short abstract about what this document is about with an outline. That'd be useful.


### 6. Reporting API

Provider must provide an authenticated reporting API that allows querying of all transactions created using Edge. The reporting API must provide at minimum the following information for each transaction. Actual values are only examples. Similar values that can be mapped to the below are sufficient. API must allow paginated queries with start date, end date, and number of values.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "number of values" mean here?


### 9. User Authentication

Provider API should allow the Edge application to authenticate a user via cryptographically random authKey. The authKey should be created by Edge and passed into any quoting or order execution endpoint. If the authKey does not exist on the Provider system, the Provider's API should allow for account creation by receiving KYC info via API
Copy link
Contributor

Choose a reason for hiding this comment

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

"by receiving optional KYC info"? Or, how can we say that KYC isn't necessarily required because it depends on jurisdictional requirements?

@paullinator
Copy link
Member Author

/rebase

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.

3 participants