Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@safe-global/safe-gateway-typescript-sdk",
"version": "3.20.0",
"version": "3.21.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time let's do it as a separate commit, easier to see in the history when a version was released.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do a normal merge (non-squash) to keep it a separate commit :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nvm its disabled.

"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { DEFAULT_BASE_URL } from './config'
import type { DelegateResponse, DelegatesRequest } from './types/delegates'
import type { GetEmailResponse } from './types/emails'
import type { RelayCountResponse, RelayTransactionResponse } from './types/relay'
import type { Contract } from './types/contracts'

export * from './types/safe-info'
export * from './types/safe-apps'
Expand Down Expand Up @@ -630,4 +631,13 @@ export function getSafeOverviews(
})
}

export function getContract(chainId: string, contractAddress: string): Promise<Contract> {
return getEndpoint(baseUrl, '/v1/chains/{chainId}/contracts/{contractAddress}', {
path: {
chainId: chainId,
contractAddress: contractAddress,
},
})
}

/* eslint-enable @typescript-eslint/explicit-module-boundary-types */
23 changes: 23 additions & 0 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import type {
} from './emails'
import type { RelayCountResponse, RelayTransactionRequest, RelayTransactionResponse } from './relay'
import type { RegisterRecoveryModuleRequestBody } from './recovery'
import type { Contract } from './contracts'

export type Primitive = string | number | boolean | null

Expand Down Expand Up @@ -442,6 +443,15 @@ export interface paths extends PathRegistry {
path: null
}
}
'/v1/chains/{chainId}/contracts/{contractAddress}': {
get: operations['get_contract']
parameters: {
path: {
chainId: string
contractAddress: string
}
}
}
}

export interface operations {
Expand Down Expand Up @@ -1156,4 +1166,17 @@ export interface operations {
}
}
}
get_contract: {
parameters: {
path: {
chainId: string
contractAddress: string
}
}
responses: {
200: {
schema: Contract
}
}
}
}
8 changes: 8 additions & 0 deletions src/types/contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Contract = {
address: string
name: string
displayName: string
logoUri: string
contractAbi: object | null
trustedForDelegateCall: boolean
}