-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: onboard IST with elements button #98
Conversation
Deploying ui-kit with Cloudflare Pages
|
type Chain = (typeof chains)[number]; | ||
type AssetList = (typeof assets)[number]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { AssetList, Chain } from '@chain-registry/types';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was seeing some type mismatch and resorted to this, but tried it again and it seems to build 👍
@@ -0,0 +1,2 @@ | |||
export const Ist = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does one generate this? I forget whether that's documented. Either way, please leave some comment in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can copy the data uri of an image in chrome dev tools or with various web apps. Just added a comment.
export const useElementsWalletClient = (): WalletClient => { | ||
const { client } = useWalletClient(); | ||
|
||
// @ts-expect-error Mismatch between `Long` type in `signDoc` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that mismatch handled by line 29? this seems like it's about something else. see if you can ignore a smaller scope or use casting to resolve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is without the expect-errors, I needed to put them in both places:
$ yarn build
src/lib/utils/leapElementsClient.ts:8:9 - error TS2322: Type '{ enable: (chainIds: string | string[]) => Promise<void>; getAccount: (chainId: string) => Promise<{ bech32Address: string; pubKey: Uint8Array; isNanoLedger: boolean; }>; getSigner: (chainId: string) => Promise<...>; }' is not assignable to type 'WalletClient'.
The types returned by 'getSigner(...)' are incompatible between these types.
Type 'Promise<{ signDirect: (address: string, signDoc: SignDoc) => Promise<{ signature: Uint8Array; signed: SignDoc; }>; signAmino: (address: string, signDoc: StdSignDoc) => Promise<...>; }>' is not assignable to type 'Promise<Signer>'.
Type '{ signDirect: (address: string, signDoc: SignDoc) => Promise<{ signature: Uint8Array; signed: SignDoc; }>; signAmino: (address: string, signDoc: StdSignDoc) => Promise<...>; }' is not assignable to type 'Signer'.
The types returned by 'signDirect(...)' are incompatible between these types.
Type 'Promise<{ signature: Uint8Array; signed: SignDoc; }>' is not assignable to type 'Promise<SignDirectResponse | TxRaw>'.
Type '{ signature: Uint8Array; signed: SignDoc; }' is not assignable to type 'SignDirectResponse | TxRaw'.
Type '{ signature: Uint8Array; signed: SignDoc; }' is not assignable to type 'SignDirectResponse'.
The types of 'signed.accountNumber' are incompatible between these types.
Type 'bigint' is not assignable to type 'Long'.
8 const walletClient: WalletClient = useMemo(() => {
~~~~~~~~~~~~
src/lib/utils/leapElementsClient.ts:28:61 - error TS2345: Argument of type 'import("/home/samsiegart/ui-kit/node_modules/@leapwallet/elements-core/node_modules/cosmjs-types/cosmos/tx/v1beta1/tx").SignDoc' is not assignable to parameter of type 'import("/home/samsiegart/ui-kit/node_modules/cosmjs-types/cosmos/tx/v1beta1/tx").SignDoc'.
Types of property 'accountNumber' are incompatible.
Type 'Long' is not assignable to type 'bigint'.
28 const result = await signer.signDirect(address, signDoc);
~~~~~~~
Found 2 errors in the same file, starting at: src/lib/utils/leapElementsClient.ts:8
So seems like the cosmjs-types
in leap and cosmos-kit differ. I'm not sure how to cast in this scenario, but the errors seem inconsequential.
@@ -33,6 +33,8 @@ type VBankAssets = [ | |||
|
|||
/** @typedef {import('@agoric/ertp/src/types.js').Amount<'nat'>['value']} NatValue */ | |||
|
|||
/** @typedef {import('@agoric/ertp/src/types.js').Amount<'nat'>['value']} NatValue */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a .ts
file so the jsdoc tyepdefs do nothing.
this and the one above should be removed. Line 19 actually imports the type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yea this seems to be a merge artifact, removed.
refs #78
This PR bases off #97, will move out of draft after that merges.
This will eventually be used in the provision-wallet-notice dialog (future PR), but can also be used standalone.
It uses the
interchain-ui
button component so it's themeable with theThemeProvider
and looks consistent with the network dropdown and wallet connection modal.Also exposes
leapElementsClient
if clients need to use leap elements in a different context.Testing
Tested with dapp-offer-up in Agoric/dapp-offer-up@55946ae
Screenshots