Skip to content

Commit a34d277

Browse files
authored
CIP-0030 | Encourage namespaced extension endpoints (#577)
* stipulate namespaced extensions * chose better number example * Added removing leading zeros * made namspacing partially optional * added that authors have to justify * address draft extensions * remove over perscriptive draft extension protocol * small stipulation added
1 parent e35bedd commit a34d277

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

CIP-0030/README.md

+23-3
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ Upon start, dApp can explicitly request a list of additional functionalities the
200200
201201
DApps are expected to use this endpoint to perform an initial handshake and ensure that the wallet supports all their required functionalities. Note that it's possible for two extensions to be mutually incompatible (because they provide two conflicting features). While we may try to avoid this as much as possible while designing CIPs, it is also the responsability of wallet providers to assess whether they can support a given combination of extensions, or not. Hence wallets aren't expected to fail should they not recognize or not support a particular combination of extensions. Instead, they should decide what they enable and reflect their choice in the response to `api.getExtensions()` in the Full API. As a result, dApps may fail and inform their users or may use a different, less-efficient, strategy to cope with a lack of functionality.
202202
203+
It is at the extension author's discretion if they wish to separate their endpoints from the base API via namespacing. Although, it is highly recommend that authors do namespace all of their extensions. If namespaced, endpoints must be preceded by `.cipXXXX.` from the `API` object, without any leading zeros.
204+
205+
For example; CIP-0123's endpoints should be accessed by:
206+
```ts
207+
api.cip123.endpoint1()
208+
api.cip123.endpoint2()
209+
```
210+
211+
Authors should be careful when omitting namespacing. Omission should only be considered when creating endpoints to override those defined in this specification or other extensions. Even so when overriding; the new functionality should not prevent dApps from accessing past functionality thus overriding must ensure backwards compatibility.
212+
213+
Any namespace omission needs to be fully justified via the proposal's Rationale section, with explanation to why it is necessary. Any potential backwards compatibility considerations should be noted to give wallets and dApps a clear unambiguous direction.
214+
215+
##### Draft or Experimental Extensions
216+
217+
Extensions that are draft, in development, or prototyped should not use extension naming nor should they use official namspacing until assigned a CIP number. Draft extension authors are free to test their implementation endpoints by using the [Experimental API](#experimental-api). Once a CIP number is assigned implementors should move functionality out of the experimental API.
218+
203219
##### Can extensions depend on other extensions?
204220
205221
Yes. Extensions may have other extensions as pre-requisite. Some newer extensions may also invalidate functionality introduced by earlier extensions. There's no particular rule or constraints in that regards. Extensions are specified as CIP, and will define what it entails to enable them.
@@ -210,7 +226,7 @@ Yes. They all are CIPs.
210226
211227
##### Can extensions add their own endpoints and/or error codes?
212228
213-
Yes. Extensions may introduce new endpoints or error codes, and modify existing ones. Extensions may even change the rules outlined in this very proposal. The idea being that wallet providers should start off implementing this CIP, and then walk their way to implementing their chosen extensions.
229+
Yes. Extensions may introduce new endpoints or error codes, and modify existing ones. Although, it is recommended that endpoints are namespaced. Extensions may even change the rules outlined in this very proposal. The idea being that wallet providers should start off implementing this CIP, and then walk their way to implementing their chosen extensions.
214230
215231
##### Are wallet expected to implement all extensions?
216232
@@ -370,6 +386,10 @@ Extensions can be seen as a smart versioning scheme. Except that, instead of bei
370386
2. Not everyone agrees and has desired to support every existing standard;
371387
3. There's a need from an API consumer standpoint to clearly identify what features are supported by providers.
372388
389+
#### Namespacing Extensions
390+
391+
By encouraging the explicit namespacing of each extension we aim to improve the usability of extensions for dApps. By allowing special cases where namespacing can be dropped we maintain good flexibility in extension design.
392+
373393
## Path to Active
374394
375395
### Acceptance Criteria
@@ -385,8 +405,8 @@ Extensions can be seen as a smart versioning scheme. Except that, instead of bei
385405
### Implementation Plan
386406
387407
- [x] Provide some reference implementation of wallet providers
388-
- [Berry-Pool/nami-wallet](https://github.com/Berry-Pool/nami-wallet/blob/master/src/pages/Content/injected.js)
389-
- [Emurgo/yoroi-wallet](https://github.com/Emurgo/yoroi-frontend/blob/develop/packages/yoroi-ergo-connector/src/inject.js)
408+
- [Berry-Pool/nami-wallet](https://github.com/berry-pool/nami/blob/4d7539b2768464480a9cff53a2d66af9879f8534/src/pages/Content/injected.js)
409+
- [Emurgo/yoroi-wallet](https://github.com/Emurgo/yoroi-frontend/blob/f4eabb25eedd564821514059479835601f8073ab/packages/yoroi-connector/example-cardano/index.js)
390410
391411
- [x] Provide some reference implementation of the dapp connector
392412
- [cardano-foundation/connect-with-wallet](https://github.com/cardano-foundation/cardano-connect-with-wallet)

0 commit comments

Comments
 (0)