From 7ae09a0c118d75b1c2f8ee510bd132e18815d180 Mon Sep 17 00:00:00 2001 From: Thunnini Date: Mon, 12 Dec 2022 17:50:40 +0900 Subject: [PATCH] Change some typings --- types/api-response.ts | 6 +++++- wallets/keplr.ts | 22 ++++++++++++---------- wallets/types.ts | 22 ++++++++++++---------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/types/api-response.ts b/types/api-response.ts index 063453f..0be5888 100644 --- a/types/api-response.ts +++ b/types/api-response.ts @@ -21,8 +21,12 @@ export interface IcnsVerificationResponse { value: { errors: Error[]; data: { + // JSON string verifying_msg: string; - signature: number[]; + // Base64 encoded + public_key: string; + // Base64 encoded + signature: string; algorithm: string; }; }; diff --git a/wallets/keplr.ts b/wallets/keplr.ts index 40a3b54..849bf35 100644 --- a/wallets/keplr.ts +++ b/wallets/keplr.ts @@ -54,7 +54,7 @@ export class KeplrWallet implements Wallet { getKey(chainId: string): Promise<{ readonly name: string; readonly pubKey: Uint8Array; - readonly address: Uint8Array; + readonly bech32Address: string; }> { return this.keplr.getKey(chainId); } @@ -77,15 +77,17 @@ export class KeplrWallet implements Wallet { owner: string, username: string, addressChainIds: string[], - ): Promise<{ - chainId: string; - bech32Prefix: string; - bech32Address: string; - addressHash: "cosmos" | "ethereum"; - pubKey: Uint8Array; - signatureSalt: number; - signature: Uint8Array; - }> { + ): Promise< + { + chainId: string; + bech32Prefix: string; + bech32Address: string; + addressHash: "cosmos" | "ethereum"; + pubKey: Uint8Array; + signatureSalt: number; + signature: Uint8Array; + }[] + > { // TODO: Update @keplr-wallet/types return (this.keplr as any).signICNSAdr36( chainId, diff --git a/wallets/types.ts b/wallets/types.ts index 2a05849..61ef521 100644 --- a/wallets/types.ts +++ b/wallets/types.ts @@ -10,7 +10,7 @@ export interface Wallet { getKey(chainId: string): Promise<{ readonly name: string; readonly pubKey: Uint8Array; - readonly address: Uint8Array; + readonly bech32Address: string; }>; signAmino( chainId: string, @@ -25,13 +25,15 @@ export interface Wallet { owner: string, username: string, addressChainIds: string[], - ): Promise<{ - chainId: string; - bech32Prefix: string; - bech32Address: string; - addressHash: "cosmos" | "ethereum"; - pubKey: Uint8Array; - signatureSalt: number; - signature: Uint8Array; - }>; + ): Promise< + { + chainId: string; + bech32Prefix: string; + bech32Address: string; + addressHash: "cosmos" | "ethereum"; + pubKey: Uint8Array; + signatureSalt: number; + signature: Uint8Array; + }[] + >; }