-
Notifications
You must be signed in to change notification settings - Fork 84
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
Wallet client API #117
Comments
Leaving my thoughts so far:
Would love to hear @yknl thoughts, especially regarding wallet-connect |
Wallet Connect docs from Xverse: https://docs.xverse.app/wallet-connect/reference/api_reference |
FYI - cleaned up some spam comments |
Leaving my thought and drafts here for now... Based on @kyranjamie's work -- Maybe we should use a more collaborative doc for this, if folks even agree. I don't want to overstep 🤷♂ SIP Draft — Wallet Client APIThis SIP describes a simpler standard for apps to interface with wallet clients. AbstractThis proposal outlines a uniform manner with which apps can interface with wallet clients. It recommends to minimise the surface area of available APIs, and makes design decisions similar to those in other crypto ecosystems. IntroductionNo standard exists describing how apps interact with Stacks-compatible wallets. Presently, ecosystem wallets adhere to an undocumented set of commands that wallets should implement. A well-documented API, that’s familiar to developers from other ecosystems, benefits both app and wallet developers. The purpose of this SIP is to describe the outline of an API that can support multiple environments including, but not limited to, Web Extensions, mobile wallets, CLIs etc. It does not describe the individual methods that clients may commonly support. Specification — Wallet ClientA
|
field | type | examples |
---|---|---|
postConditions | ||
postConditionMode | ||
nonce | ||
fee |
Type Serialization/Deserialization
-
Bytes shall be encoded as strings prefixed by
0x
-
BigInts shall be encoded as strings parseable by the
BigInt()
JS constructor. -
fee
,from
attributes, which can be inferred or selected from the wallet are optional -
Addresses?
-
fee
,nonce
= BigInt
WalletConnect
The same params defined for Stacks SIPs should be re-used for adapters like WalletConnect.
This way wallets can share code and provide the same interface directly or via WalletConnect sessions.
#2: [Bitcoin] Types
#3: Multi-Chain / Layer -- Client
Provide Stacks
Client under window.WalletClient
which can expose multiple layers of bitcoin. This way
window.WalletClient.Stacks ...
// ↑
// The same as StacksClient, but can group more functionality (e.g. BTC transfers)
Related Work
- https://eips.ethereum.org/EIPS/eip-1102
- https://eips.ethereum.org/EIPS/eip-1474
- https://eips.ethereum.org/EIPS/eip-2255
- https://github.com/nostr-protocol/nips/blob/master/07.md
- https://walletconnect.com
- https://docs.walletconnect.com/2.0/specs/
- https://docs.walletconnect.com/2.0/specs/clients/sign/client-api
- https://docs.walletconnect.com/2.0/javascript/providers/ethereum#events
This proposal would help greatly in implementing wallet connecting for game engines with web exports, like Unity and Godot. The current JWT-based API is difficult to work with, so I support this change. |
Xverse launched open source wallet connect standard called "Sats Connect", just to make sure it's captured in this conversation. |
Note that the http://btckit.org/ standard we've started using for Hiro Wallet includes the Sats Connect chose not to apply such a Sats Connect was also promoted as a new API / library, not a standard per se, so it's not clear whether as a library it can incorporate |
There should be a standard describing the style of API used by wallet clients.
@friedger pushed a draft SIP a while back describing the existing wallet API. Though, more recently, there's been some discussion about moving away from the existing JWT-style API towards something more consistent with other ecosystems, like an RPC style API.
I suggest a SIP that describes a feature-agnostic RPC API that works cross-platform: Web Extensions, mobile apps, CLIs etc, similar to that of
EIP-1102
.SIP Draft
Wallet Client API
This SIP describes a simpler standard for apps to interface with wallet clients.
Abstract
This proposal outlines a uniform manner with which apps can interface with wallet clients.
It recommends to minimise the surface area of available APIs, and makes design decisions similar to those in other crypto ecosystems.
Introduction
No standard exists describing how apps interact with Stacks-compatible wallets. Presently, ecosystem wallets adhere to an undocumented set of commands that wallets should implement. A well-documented API, that’s familiar to developers from other ecosystems, benefits both app and wallet developers.
The purpose of this SIP is to describe the outline of an API that can support multiple environments including, but not limited to, Web Extensions, mobile wallets, CLIs etc. It does not describe the individual methods that clients may commonly support.
Specification
Two methods are described. The methods can be typed such that the return value corresponds to the method name passed.
request
request(method: string, params?: object[]): Promise<T>
A
request
method is accepted by clients, following the JSON RPC standardExample
listen
listen(event: string): Observable<T>
A
listen
method accepts an event parameter. It returns anObservable
, following the TC39 specification, that consumers can subscribe and unsubscribe to.Example
Related Work
https://eips.ethereum.org/EIPS/eip-1102
https://eips.ethereum.org/EIPS/eip-1474
https://eips.ethereum.org/EIPS/eip-2255
Backwards Compatibility
Wallet clients should continue to support the existing methods until a time where a sufficient majority of apps adhere to the new standard. They may warn developers of the newer format, encouraging developer to migrate.
Activation
This SIP is considered activated when at least two wallet clients support this API.
Happy to work on this with anyone that wants to collaborate.
cc/ @janniks @yknl @markmhx @fbwoolf @edu-stx
Edit: March 2023 update
With the suggestions/ideas from this SIP @janniks and I have started http://btckit.org, which aims to push this effort and form a community-driven, wallet-agnostic standard.
The text was updated successfully, but these errors were encountered: