Skip to content

Commit 00c4339

Browse files
authored
Add types for safe apps access control property and clientUrl param to the query (#51)
* add types for safe apps access control and client url to the query * add an enum for safe app access policies * remove dump file, update package json * package.json update * export enum with policy types
1 parent 9e50873 commit 00c4339

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gnosis.pm/safe-react-gateway-sdk",
3-
"version": "2.7.5",
3+
"version": "2.8.0",
44
"main": "dist/index.min.js",
55
"types": "dist/index.d.ts",
66
"files": [

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,14 @@ export function getChainConfig(baseUrl: string, chainId: string): Promise<ChainI
168168
/**
169169
* Returns Safe Apps List
170170
*/
171-
export function getSafeApps(baseUrl: string, chainId: string): Promise<SafeAppsResponse> {
171+
export function getSafeApps(
172+
baseUrl: string,
173+
chainId: string,
174+
query: operations['safe_apps_read']['parameters']['query'] = {},
175+
): Promise<SafeAppsResponse> {
172176
return callEndpoint(baseUrl, '/v1/chains/{chainId}/safe-apps', {
173177
path: { chainId: chainId },
178+
query,
174179
})
175180
}
176181

src/types/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ export interface operations {
357357
/** A unique value identifying this chain. */
358358
chainId: string
359359
}
360+
query?: {
361+
clientUrl?: string
362+
}
360363
}
361364
responses: {
362365
200: {

src/types/safe-apps.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
export enum SafeAppAccessPolicyTypes {
2+
NoRestrictions = 'NO_RESTRICTIONS',
3+
DomainAllowlist = 'DOMAIN_ALLOWLIST',
4+
}
5+
6+
export type SafeAppNoRestrictionsPolicy = {
7+
type: SafeAppAccessPolicyTypes.NoRestrictions
8+
}
9+
10+
export type SafeAppDomainAllowlistPolicy = {
11+
type: SafeAppAccessPolicyTypes.DomainAllowlist
12+
value: string[]
13+
}
14+
15+
export type SafeAppsAccessControlPolicies = SafeAppNoRestrictionsPolicy | SafeAppDomainAllowlistPolicy
16+
117
export type SafeAppProvider = {
218
url: string
319
name: string
@@ -11,6 +27,7 @@ export type SafeAppData = {
1127
description: string
1228
chainIds: string[]
1329
provider?: SafeAppProvider
30+
accessControl: SafeAppsAccessControlPolicies
1431
}
1532

1633
export type SafeAppsResponse = [SafeAppData]

0 commit comments

Comments
 (0)