1- import { WalletClient , WalletAccount } from '@cosmos-kit/core' ;
1+ import { AminoSignResponse , StdSignDoc } from '@cosmjs/amino' ;
2+ import { SignOptions , WalletAccount , WalletClient } from '@cosmos-kit/core' ;
23import Station from '@terra-money/station-connector' ;
34
45export class StationClient implements WalletClient {
@@ -13,7 +14,7 @@ export class StationClient implements WalletClient {
1314 }
1415
1516 async getSimpleAccount ( chainId : string ) {
16- const { name, addresses } = await this . client ? .connect ( ) ;
17+ const { name, addresses } = await this . client . connect ( ) ;
1718
1819 const address = addresses [ chainId ] ;
1920
@@ -31,15 +32,15 @@ export class StationClient implements WalletClient {
3132 }
3233
3334 async getAccount ( chainId : string ) : Promise < WalletAccount > {
34- const info = ( await this . client ? .info ( ) ) [ chainId ] ;
35+ const info = ( await this . client . info ( ) ) [ chainId ] ;
3536 if ( ! info )
3637 throw new Error (
3738 `The requested chainID (${ chainId } ) is not available, try to switch network on the Station extension.`
3839 ) ;
3940
40- let { name, addresses, pubkey : pubkeys } = await this . client ? .connect ( ) ;
41+ let { name, addresses, pubkey : pubkeys } = await this . client . connect ( ) ;
4142 if ( ! pubkeys ) {
42- pubkeys = ( await this . client ? .getPublicKey ( ) ) . pubkey ;
43+ pubkeys = ( await this . client . getPublicKey ( ) ) . pubkey ;
4344 }
4445 const pubkey = pubkeys ?. [ info . coinType ] ;
4546 const address = addresses [ chainId ] ;
@@ -58,6 +59,15 @@ export class StationClient implements WalletClient {
5859 } ;
5960 }
6061
62+ async signAmino (
63+ chainId : string ,
64+ signer : string ,
65+ signDoc : StdSignDoc ,
66+ _signOptions ?: SignOptions
67+ ) : Promise < AminoSignResponse > {
68+ return await this . client . keplr . signAmino ( chainId , signer , signDoc ) ;
69+ }
70+
6171 async getOfflineSigner ( chainId : string ) {
6272 return await this . client . getOfflineSigner ( chainId ) ;
6373 }
0 commit comments