From 35a7039f7747e69f6fac22b673e7c60c36d7e32c Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Thu, 29 Feb 2024 10:50:42 +0100 Subject: [PATCH] feat: Add register module address endpoint --- src/index.ts | 17 +++++++++++++++++ src/types/api.ts | 25 +++++++++++++++++++++++++ src/types/recovery.ts | 3 +++ 3 files changed, 45 insertions(+) create mode 100644 src/types/recovery.ts diff --git a/src/index.ts b/src/index.ts index 076b581b..7225d977 100644 --- a/src/index.ts +++ b/src/index.ts @@ -566,4 +566,21 @@ export function deleteRegisteredEmail( }) } +/** + * Register a recovery module for receiving alerts + * @param chainId + * @param safeAddress + * @param body - { moduleAddress: string } + */ +export function registerRecoveryModule( + chainId: string, + safeAddress: string, + body: operations['register_recovery_module']['parameters']['body'], +): Promise { + return postEndpoint(baseUrl, '/v1/chains/{chainId}/safes/{safe_address}/recovery', { + path: { chainId, safe_address: safeAddress }, + body, + }) +} + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ diff --git a/src/types/api.ts b/src/types/api.ts index 9cba604b..23c288dd 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -38,6 +38,7 @@ import type { VerifyEmailRequestBody, } from './emails' import type { RelayCountResponse, RelayTransactionRequest, RelayTransactionResponse } from './relay' +import type { RegisterRecoveryModuleRequestBody } from './recovery' export type Primitive = string | number | boolean | null @@ -399,6 +400,15 @@ export interface paths extends PathRegistry { } } } + '/v1/chains/{chainId}/safes/{safe_address}/recovery': { + post: operations['register_recovery_module'] + parameters: { + path: { + chainId: string + safe_address: string + } + } + } } export interface operations { @@ -1038,4 +1048,19 @@ export interface operations { 403: unknown } } + register_recovery_module: { + parameters: { + path: { + chainId: string + safe_address: string + } + body: RegisterRecoveryModuleRequestBody + } + + responses: { + 200: { + schema: void + } + } + } } diff --git a/src/types/recovery.ts b/src/types/recovery.ts new file mode 100644 index 00000000..e66ae79a --- /dev/null +++ b/src/types/recovery.ts @@ -0,0 +1,3 @@ +export type RegisterRecoveryModuleRequestBody = { + moduleAddress: string +}