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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ yarn test

N.B.: the e2e tests make actual API calls on staging.


## Gateway API docs

The TypeScript types in this SDK are based on [Rust types](https://safe-global.github.io/safe-client-gateway/docs/routes/index.html) from the Gateway API.
11 changes: 10 additions & 1 deletion e2e/safes-read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('getSafeInfo tests', () => {
setBaseUrl(config.baseUrl)
})

it('should get safe info on rinkeby', async () => {
it('should get a 1.1.1 Safe on Rinkeby', async () => {
const address = '0x9B5dc27B104356516B05b02F6166a54F6D74e40B'
const data = await getSafeInfo('4', address)

Expand All @@ -22,5 +22,14 @@ describe('getSafeInfo tests', () => {
])
expect(data.threshold).toBe(1)
expect(data.version).toBe('1.1.1')
expect(data.implementationVersionState).toBe('OUTDATED')
})

it('should get a 1.3.0 Safe on Rinkeby', async () => {
const address = '0xb3b83bf204C458B461de9B0CD2739DB152b4fa5A'
const data = await getSafeInfo('4', address)

expect(data.version).toBe('1.3.0')
expect(data.implementationVersionState).toBe('UP_TO_DATE')
})
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-react-gateway-sdk",
"version": "3.2.1",
"version": "3.2.2",
"main": "dist/index.min.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import {
SafeBalanceResponse,
SafeCollectibleResponse,
SafeIncomingTransfersResponse,
SafeInfo,
SafeModuleTransactionsResponse,
SafeMultisigTransactionsResponse,
} from './types/common'
import { SafeInfo } from './types/safe-info'
import { ChainListResponse, ChainInfo } from './types/chains'
import { SafeAppsResponse } from './types/safe-apps'
import { MasterCopyReponse } from './types/master-copies'
import { DecodedDataResponse } from './types/decoded-data'
import { DEFAULT_BASE_URL } from './config'

export * from './types/safe-info'
export * from './types/safe-apps'
export * from './types/transactions'
export * from './types/chains'
Expand Down
16 changes: 0 additions & 16 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,6 @@ export type AddressEx = {
logoUri?: string
}

export type SafeInfo = {
address: AddressEx
chainId: string
nonce: number
threshold: number
owners: AddressEx[]
implementation: AddressEx
modules: AddressEx[] | null
guard: AddressEx | null
fallbackHandler: AddressEx
version: string
collectiblesTag: string
txQueuedTag: string
txHistoryTag: string
}

export type FiatCurrencies = string[]

export type OwnedSafes = { safes: string[] }
Expand Down
23 changes: 23 additions & 0 deletions src/types/safe-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AddressEx } from './common'

export enum ImplementationVersionState {
UP_TO_DATE = 'UP_TO_DATE',
OUTDATED = 'OUTDATED',
}

export type SafeInfo = {
address: AddressEx
chainId: string
nonce: number
threshold: number
owners: AddressEx[]
implementation: AddressEx
implementationVersionState: ImplementationVersionState
modules: AddressEx[] | null
guard: AddressEx | null
fallbackHandler: AddressEx
version: string
collectiblesTag: string
txQueuedTag: string
txHistoryTag: string
}