Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Jun 18, 2024
1 parent 1e6d1b6 commit 5a00a91
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 48 deletions.
4 changes: 2 additions & 2 deletions wallets/leap-capsule-social-login/src/chain-wallet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChainRecord, ChainWalletBase,Wallet } from '@cosmos-kit/core'
import { ChainRecord, ChainWalletBase, Wallet } from '@cosmos-kit/core';

export class ChainCosmosSocial extends ChainWalletBase {
constructor(walletInfo: Wallet, chainInfo: ChainRecord) {
super(walletInfo, chainInfo)
super(walletInfo, chainInfo);
}
}
34 changes: 21 additions & 13 deletions wallets/leap-capsule-social-login/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF

import { StdSignDoc } from "@cosmjs/amino";
import { SignOptions, SignType } from "@cosmos-kit/core";
import { DirectSignDoc, WalletClient } from "@cosmos-kit/core";
import { CapsuleProvider } from "@leapwallet/cosmos-social-login-capsule-provider";
import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { StdSignDoc } from '@cosmjs/amino';
import { SignOptions, SignType } from '@cosmos-kit/core';
import { DirectSignDoc, WalletClient } from '@cosmos-kit/core';
import { CapsuleProvider } from '@leapwallet/cosmos-social-login-capsule-provider';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';

export class CosmosCapsuleClient implements WalletClient {
readonly loginProvider: CapsuleProvider;

constructor(options: { loginProvider: CapsuleProvider }) {
this.loginProvider = options.loginProvider
this.loginProvider = options.loginProvider;
}

async disconnect() {
Expand All @@ -20,7 +20,7 @@ export class CosmosCapsuleClient implements WalletClient {
async getSimpleAccount(chainId: string) {
const { address, username } = await this.getAccount(chainId);
return {
namespace: "cosmos",
namespace: 'cosmos',
chainId,
address,
username,
Expand All @@ -29,7 +29,7 @@ export class CosmosCapsuleClient implements WalletClient {

async enable() {
await this.handleConnect();
}
}

async handleConnect() {
await this.loginProvider.handleConnect();
Expand All @@ -40,7 +40,7 @@ export class CosmosCapsuleClient implements WalletClient {
}

getOfflineSigner(chainId: string, preferredSignType?: SignType) {
return this.loginProvider.getOfflineSigner(chainId, preferredSignType)
return this.loginProvider.getOfflineSigner(chainId, preferredSignType);
}

getOfflineSignerAmino(chainId: string): any {
Expand All @@ -55,12 +55,20 @@ export class CosmosCapsuleClient implements WalletClient {
chainId: string,
signer: string,
signDoc: StdSignDoc,
signOptions?: SignOptions,
signOptions?: SignOptions
) {
return this.loginProvider.signAmino(chainId, signer, signDoc, signOptions)
return this.loginProvider.signAmino(chainId, signer, signDoc, signOptions);
}

async signDirect(chainId: string, signer: string, signDoc: DirectSignDoc): Promise<any> {
return this.loginProvider.signDirect(chainId, signer, signDoc as unknown as SignDoc);
async signDirect(
chainId: string,
signer: string,
signDoc: DirectSignDoc
): Promise<any> {
return this.loginProvider.signDirect(
chainId,
signer,
signDoc as unknown as SignDoc
);
}
}
4 changes: 2 additions & 2 deletions wallets/leap-capsule-social-login/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './chain-wallet';
export * from './constant';
export * from './main-wallet';
export * from './client';
export * from './constant';
export * from './leap-social';
export * from './main-wallet';
5 changes: 3 additions & 2 deletions wallets/leap-capsule-social-login/src/leap-social.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LeapCapsuleInfo } from "@leapwallet/cosmos-social-login-capsule-provider";
import { LeapCapsuleWallet } from "./main-wallet";
import { LeapCapsuleInfo } from '@leapwallet/cosmos-social-login-capsule-provider';

import { LeapCapsuleWallet } from './main-wallet';

const leapSocial = new LeapCapsuleWallet(LeapCapsuleInfo);

Expand Down
1 change: 1 addition & 0 deletions wallets/leap-capsule-social-login/src/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Wallet } from '@cosmos-kit/core';

import { LEAP_SOCIAL_LOGIN_LOGO } from './constant';

export const LeapSocialLoginInfo: Wallet = {
Expand Down
62 changes: 35 additions & 27 deletions wallets/leap-capsule-social-login/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
import { OfflineAminoSigner, StdSignature, StdSignDoc } from '@cosmjs/amino'
import { OfflineDirectSigner } from '@cosmjs/proto-signing'
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx'
import { OfflineAminoSigner, StdSignature, StdSignDoc } from '@cosmjs/amino';
import { OfflineDirectSigner } from '@cosmjs/proto-signing';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';

export interface LeapAccount {
address: string
algo: string
bech32Address: string
isNanoLedger: boolean
name: string
pubKey: string
address: string;
algo: string;
bech32Address: string;
isNanoLedger: boolean;
name: string;
pubKey: string;
}

export type capsuleOptions = {
apiKey: string
}
apiKey: string;
};

export type CosmosCapsule = {
enable: (chainIds: string[] | string) => Promise<void>
suggestToken: (chainId: string, contractAddress: string) => Promise<void>
experimentalSuggestChain: (chainInfo: unknown) => Promise<void>
disconnect: () => Promise<void>
getKey: (chainId: string) => Promise<LeapAccount>
getOfflineSignerOnlyAmino: (chainId: string) => Promise<OfflineDirectSigner>
getOfflineSigner: (chainId: string) => Promise<OfflineDirectSigner>
signAmino: (chainId: string, signer: string, signDoc: StdSignDoc) => Promise<StdSignature>
enable: (chainIds: string[] | string) => Promise<void>;
suggestToken: (chainId: string, contractAddress: string) => Promise<void>;
experimentalSuggestChain: (chainInfo: unknown) => Promise<void>;
disconnect: () => Promise<void>;
getKey: (chainId: string) => Promise<LeapAccount>;
getOfflineSignerOnlyAmino: (chainId: string) => Promise<OfflineDirectSigner>;
getOfflineSigner: (chainId: string) => Promise<OfflineDirectSigner>;
signAmino: (
chainId: string,
signer: string,
signDoc: StdSignDoc
) => Promise<StdSignature>;
signArbitrary: (
chainId: string,
signer: string,
data: string | Uint8Array,
) => Promise<StdSignature>
signDirect: (chainId: string, signer: string, signDoc: SignDoc) => Promise<StdSignature>
getOfflineSignerAuto: (chainId: string) => OfflineDirectSigner
getOfflineSignerDirect: (chainId: string) => OfflineDirectSigner
getOfflineSignerAmino: (chainId: string) => OfflineAminoSigner
request: unknown
}
data: string | Uint8Array
) => Promise<StdSignature>;
signDirect: (
chainId: string,
signer: string,
signDoc: SignDoc
) => Promise<StdSignature>;
getOfflineSignerAuto: (chainId: string) => OfflineDirectSigner;
getOfflineSignerDirect: (chainId: string) => OfflineDirectSigner;
getOfflineSignerAmino: (chainId: string) => OfflineAminoSigner;
request: unknown;
};
2 changes: 1 addition & 1 deletion wallets/leap-extension/src/extension/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
SuggestToken,
} from '@cosmos-kit/core';
import { DirectSignDoc, SignOptions, WalletClient } from '@cosmos-kit/core';
import Long from 'long';

import { Leap } from './types';
import Long from 'long';

export class LeapClient implements WalletClient {
readonly client: Leap;
Expand Down
2 changes: 1 addition & 1 deletion wallets/leap/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { wallets as ext } from '@cosmos-kit/leap-extension';
import { wallets as mobile } from '@cosmos-kit/leap-mobile';
import { wallets as snap } from '@cosmos-kit/leap-metamask-cosmos-snap';
import { wallets as mobile } from '@cosmos-kit/leap-mobile';

export const wallets = [...ext, ...mobile, ...snap];

0 comments on commit 5a00a91

Please sign in to comment.