Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIP-29: Snap Assets API #154

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

SIP-29: Snap Assets API #154

wants to merge 7 commits into from

Conversation

danroc
Copy link
Contributor

@danroc danroc commented Dec 5, 2024

No description provided.

): TokenConversionRate;
```

### Fiat currency representation
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 create a CAIP for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. This is technically CAIP-19, but with unregistered namespaces.

I started a discussion on the CAIPs repo, let's see what other think of it.

SIPS/sip-29.md Outdated Show resolved Hide resolved
@GuillaumeRx GuillaumeRx mentioned this pull request Dec 5, 2024
GuillaumeRx and others added 2 commits December 6, 2024 17:24
* add handlers and permission definition

* update to use `snaps-sdk`

* snap -> Snap

* Add CAIP-19 ID reference in description and rename token to asset

* Add chains caveat

* fix typo

* allow batching

* add fungible reference to asset description

* add appendix for fungible assets

* fix typos

* update rates handler to support batching

* unify

* rename `AssetUnit` to `FungibleAssetUnit`
fungible: true;

// Base64 representation of the asset icon.
iconBase64: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this be an URL link to the icon?

Choose a reason for hiding this comment

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

I think it has to be an icon, the static token icon server is going to return pngs

ticker: string;

// Whether the asset is native to the chain.
native: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How can we identify other types of tokens that need to be handled differently?

Copy link

Choose a reason for hiding this comment

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

Some examples might be differentiating between brc-20 and rune tokens on bitcoin. Or eth, erc20s, and staking contracts on ethereum. I anticipate more types of tokens than just native vs not. Not sure if anything built into caip19 already helps distinguish this.

The type for an `onAssetConversion` handler function’s return value is:

```typescript
type AssetConversionRate = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How can we get historical market data?

It should be closer to the terminology used by the Token API.
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.

4 participants