Skip to content
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

Bug: Fix network type in safe info #73

Merged
merged 1 commit into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/safe-apps-sdk/src/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { METHODS } from './communication';
import { Communicator, SafeInfo, EnvInfo } from './types';
import { Communicator, SafeInfoV1, EnvInfo } from './types';
import InterfaceCommunicator from './communication';
import { TXs } from './txs';
import { Eth } from './eth';
Expand Down Expand Up @@ -42,8 +42,11 @@ class SafeAppsSDK {
return response.data;
}

async getSafeInfo(): Promise<SafeInfo> {
const response = await this.#communicator.send<'getSafeInfo', undefined, SafeInfo>(METHODS.getSafeInfo, undefined);
async getSafeInfo(): Promise<SafeInfoV1> {
const response = await this.#communicator.send<'getSafeInfo', undefined, SafeInfoV1>(
METHODS.getSafeInfo,
undefined,
);

if (!response.success) {
throw new Error(response.error);
Expand Down
5 changes: 5 additions & 0 deletions packages/safe-apps-sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ export interface SafeInfo {
network: LowercaseNetworks;
}

export interface SafeInfoV1 {
safeAddress: string;
network: UppercaseNetworks;
}

export type Methods = keyof typeof METHODS;

export type SDKRequestData<M extends Methods = Methods, P = unknown> = {
Expand Down