Skip to content

Commit

Permalink
feat: Add register module address endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Feb 29, 2024
1 parent 66c90c0 commit 35a7039
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
return postEndpoint(baseUrl, '/v1/chains/{chainId}/safes/{safe_address}/recovery', {
path: { chainId, safe_address: safeAddress },
body,
})
}

/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
25 changes: 25 additions & 0 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}
}
}
3 changes: 3 additions & 0 deletions src/types/recovery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type RegisterRecoveryModuleRequestBody = {
moduleAddress: string
}

0 comments on commit 35a7039

Please sign in to comment.