Skip to content

Commit

Permalink
feat: getInfo endpoint returns extended Safe Info (#591)
Browse files Browse the repository at this point in the history
* feat: getInfo endpoint returns extended Safe Info

api-kit’s getSafeInfo endpoint returns way more information than our
communicator’s getInfo endpoint. This causes some dapps to use the
getInfo endpoint for just the readOnly flag (when running in an iframe)
and then to do api-kit getSafeInfo for the nonce and other props.
By returning nearly the same information from the getInfo endpoint we
make developers live easier.

* chore: changeset for safe-apps-sdk update

---------

Co-authored-by: katspaugh <[email protected]>
Co-authored-by: Daniel Dimitrov <[email protected]>
  • Loading branch information
3 people authored Jun 12, 2024
1 parent 22b8f25 commit e0710be
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 149 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-meals-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@safe-global/safe-apps-sdk': minor
---

safe.getInfo() endpoint should return extended safe information similar to api-kit's getSafeInfo endpoint
4 changes: 2 additions & 2 deletions packages/safe-apps-sdk/dist/cjs/safe/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js';
import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js';
declare class Safe {
private readonly communicator;
constructor(communicator: Communicator);
getChainInfo(): Promise<ChainInfo>;
getInfo(): Promise<SafeInfo>;
getInfo(): Promise<SafeInfoExtended>;
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>;
private check1271Signature;
private check1271SignatureBytes;
Expand Down
8 changes: 8 additions & 0 deletions packages/safe-apps-sdk/dist/cjs/types/sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export type SafeInfo = {
owners: string[];
isReadOnly: boolean;
};
export type SafeInfoExtended = SafeInfo & {
nonce: number;
implementation: string;
modules: string[] | null;
fallbackHandler: string | null;
guard: string | null;
version: string | null;
};
export type EnvironmentInfo = {
origin: string;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/cjs/types/sdk.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/safe-apps-sdk/dist/esm/safe/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js';
import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js';
declare class Safe {
private readonly communicator;
constructor(communicator: Communicator);
getChainInfo(): Promise<ChainInfo>;
getInfo(): Promise<SafeInfo>;
getInfo(): Promise<SafeInfoExtended>;
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>;
private check1271Signature;
private check1271SignatureBytes;
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/esm/safe/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/safe-apps-sdk/dist/esm/types/sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export type SafeInfo = {
owners: string[];
isReadOnly: boolean;
};
export type SafeInfoExtended = SafeInfo & {
nonce: number;
implementation: string;
modules: string[] | null;
fallbackHandler: string | null;
guard: string | null;
version: string | null;
};
export type EnvironmentInfo = {
origin: string;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/esm/types/sdk.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/safe-apps-sdk/dist/types/safe/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js';
import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js';
declare class Safe {
private readonly communicator;
constructor(communicator: Communicator);
getChainInfo(): Promise<ChainInfo>;
getInfo(): Promise<SafeInfo>;
getInfo(): Promise<SafeInfoExtended>;
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>;
private check1271Signature;
private check1271SignatureBytes;
Expand Down
2 changes: 1 addition & 1 deletion packages/safe-apps-sdk/dist/types/safe/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/safe-apps-sdk/dist/types/types/sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ export type SafeInfo = {
owners: string[];
isReadOnly: boolean;
};
export type SafeInfoExtended = SafeInfo & {
nonce: number;
implementation: string;
modules: string[] | null;
fallbackHandler: string | null;
guard: string | null;
version: string | null;
};
export type EnvironmentInfo = {
origin: string;
};
Expand Down
Loading

0 comments on commit e0710be

Please sign in to comment.