Repository navigation
feat: add cosmos types and multi-chain establish - #42
Merged
Merged
Conversation
- Add `AdenaCosmos` sub-namespace types (`enable`, `getKey`, `signAmino`, `signDirect`, `sendTx`) returning `WalletResponse<T>` wrappers to mirror the wallet's runtime contract. Include `getOfflineSigner`, `getOfflineSignerOnlyAmino`, and Keplr-compatible `getOfflineSignerAuto`. - Extend `WalletResponseExecuteType` with `ENABLE_COSMOS`, `GET_COSMOS_KEY`, `SIGN_COSMOS_AMINO`, `SIGN_COSMOS_DIRECT`, `SEND_COSMOS_TX` and corresponding `WalletExecuteMessageInfo` entries. - Widen `AddEstablishOptions.chainIds` to `string | string[]` and forward it through `AdenaWalletProvider.addEstablish` so a dApp can request multi-chain access (Gno + AtomOne) in a single approval. - Cover both flows with type-surface tests for `AdenaWallet.cosmos`, `WalletResponseExecuteType` cosmos entries, and single/array `chainIds` forwarding. - Bump SDK to 0.0.15. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jinoosss
approved these changes
May 7, 2026
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
Sync the SDK with the
window.adena.cosmossub-namespace and the multi-chainAddEstablishflow already exposed by the Adena wallet extension. The wallet's inject script has a TODO ("until the SDK enum catches up") — this PR is that catch-up.Background
window.adena.cosmos(enable / getKey / signAmino / signDirect / sendTx plus three offline signers) andAddEstablish(name, chainIds?), but the SDK types were missing or incorrect, forcing dApps to cast.AdenaResponsewrappers ({ status, type, code, message, data }). dApps that trusted the SDK types would break at runtime.Changes
1. Cosmos sub-namespace types
AdenaCosmosinterface:enable / getKey / signAmino / signDirect / sendTxall returnPromise<WalletResponse<T>>to match the wallet's runtime contract.getOfflineSigner,getOfflineSignerOnlyAmino, Keplr-compatiblegetOfflineSignerAuto). The auto variant resolvesisNanoLedgerfirst and returns an amino-only signer for Ledger accounts, full amino+direct otherwise. These follow the CosmJSOfflineSignercontract (bare values, throw on failure).EnableCosmosResponse,GetCosmosKeyResponse,SignCosmosAminoResponse,SignCosmosDirectResponse,SendCosmosTxResponse.AdenaWallet.cosmos?: AdenaCosmos— optional so existing dApps keep compiling.2.
WalletResponseExecuteTypeentriesENABLE_COSMOS,GET_COSMOS_KEY,SIGN_COSMOS_AMINO,SIGN_COSMOS_DIRECT,SEND_COSMOS_TXplus matchingWalletExecuteMessageInforows. Values are 1:1 with the wallet's interimCosmosResponseExecuteTypeconst so it can switch over.3. Multi-chain
AddEstablishAddEstablishOptions.chainIdswidened fromstring[]tostring | string[]so single-chain callers don't need to wrap in an array.AdenaWalletProvider.addEstablishforwardschainIdsas the second argument.4. Tests
wallet-types-cosmos.test.ts— verifies the 5 enum values andWalletMessageInforegistration.adena-cosmos.test.ts— verifies theAdenaCosmosimplementation responds with wrappers and thatgetOfflineSignerAutois callable.add-establish.test.ts— covers both single-string and arraychainIdsforwarding.5. Version
@adena-wallet/sdk0.0.14 → 0.0.15.Compatibility
AdenaWallet.cosmosis optional — works with wallet builds that don't expose the cosmos namespace.addEstablishwithoutchainIdskeeps the legacy "approve current chainGroup" behavior.response.data. In practice that code was already broken at runtime, since the wallet has always returned wrappers.Test plan
yarn workspace @adena-wallet/sdk tsc --noEmityarn workspace @adena-wallet/sdk lintyarn workspace @adena-wallet/sdk test(28 suites / 78 tests pass)adena.cosmos.enable(['atomone-1']),adena.cosmos.getKey('atomone-1'),adena.AddEstablish('demo', ['atomone-1', 'portal-loop'])resolved through a single approval popupgetOfflineSignerAutoreturns an amino-only signer for Ledger accounts and a full amino+direct signer otherwise🤖 Generated with Claude Code