Skip to content

Commit b86e6f0

Browse files
author
Aaron Cook
authored
Remove Safe transaction estimation versioning (#48)
* chore: Remove Safe tx estimation versioning * 2.7.4
1 parent f50f64d commit b86e6f0

File tree

5 files changed

+6
-56
lines changed

5 files changed

+6
-56
lines changed

e2e/post-safe-gas-estimation.test.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { postSafeGasEstimation, postSafeGasEstimationV2 } from '../src'
1+
import { postSafeGasEstimation } from '../src'
22
import config from './config'
33

44
describe('postSafeGasEstimation tests', () => {
@@ -10,18 +10,6 @@ describe('postSafeGasEstimation tests', () => {
1010
operation: 0,
1111
})
1212

13-
expect(result.safeTxGas).toBe('45006')
14-
// Nonce should match any positive integer number over 0
15-
expect(result.latestNonce).toBeGreaterThanOrEqual(0)
16-
})
17-
it('should post a safe gas estimation (v2)', async () => {
18-
const result = await postSafeGasEstimationV2(config.baseUrl, '4', '0x4f9BD57BCC68Bf7770429F137922B3afD23d83E7', {
19-
to: '0x4f9BD57BCC68Bf7770429F137922B3afD23d83E7',
20-
value: '1',
21-
data: '0x',
22-
operation: 0,
23-
})
24-
2513
expect(result.safeTxGas).toBe('45006')
2614
// Nonce should match any positive integer number over 0
2715
expect(result.currentNonce).toBeGreaterThanOrEqual(0)

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.3",
3+
"version": "2.7.4",
44
"main": "dist/index.min.js",
55
"types": "dist/index.d.ts",
66
"files": [

src/index.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { callEndpoint } from './endpoint'
22
import { operations } from './types/api'
3-
import {
4-
SafeTransactionEstimation,
5-
SafeTransactionEstimationV2,
6-
TransactionDetails,
7-
TransactionListPage,
8-
} from './types/transactions'
3+
import { SafeTransactionEstimation, TransactionDetails, TransactionListPage } from './types/transactions'
94
import { FiatCurrencies, OwnedSafes, SafeBalanceResponse, SafeCollectibleResponse, SafeInfo } from './types/common'
105
import { ChainListResponse, ChainInfo } from './types/chains'
116
import { SafeAppsResponse } from './types/safe-apps'
@@ -120,29 +115,14 @@ export function getTransactionDetails(
120115
}
121116

122117
/**
123-
* Request a gas estimate for a created transaction
118+
* Request a gas estimate & recommmended tx nonce for a created transaction
124119
*/
125120
export function postSafeGasEstimation(
126121
baseUrl: string,
127122
chainId: string,
128123
address: string,
129124
body: operations['post_safe_gas_estimation']['parameters']['body'],
130125
): Promise<SafeTransactionEstimation> {
131-
return callEndpoint(baseUrl, '/v1/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations', {
132-
path: { chainId, safe_address: address },
133-
body,
134-
})
135-
}
136-
137-
/**
138-
* Request a gas estimate & recommmended tx nonce for a created transaction
139-
*/
140-
export function postSafeGasEstimationV2(
141-
baseUrl: string,
142-
chainId: string,
143-
address: string,
144-
body: operations['post_safe_gas_estimation_v2']['parameters']['body'],
145-
): Promise<SafeTransactionEstimationV2> {
146126
return callEndpoint(baseUrl, '/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations', {
147127
path: { chainId, safe_address: address },
148128
body,

src/types/api.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
SafeTransactionEstimation,
66
SafeTransactionEstimationRequest,
77
TransactionListPage,
8-
SafeTransactionEstimationV2,
98
} from './transactions'
109
import { ChainListResponse, ChainInfo } from './chains'
1110
import { SafeAppsResponse } from './safe-apps'
@@ -74,7 +73,7 @@ export interface paths {
7473
}
7574
}
7675
}
77-
'/v1/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations': {
76+
'/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations': {
7877
/** This is actually supposed to be POST but it breaks our type paradise */
7978
get: operations['post_safe_gas_estimation']
8079
parameters: {
@@ -84,11 +83,6 @@ export interface paths {
8483
}
8584
}
8685
}
87-
'/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations': {
88-
/** This is actually supposed to be POST but it breaks our type paradise */
89-
get: operations['post_safe_gas_estimation_v2']
90-
parameters: paths['/v1/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations']['parameters']
91-
}
9286
'/v1/chains/{chainId}/transactions/{safe_address}/propose': {
9387
/** This is actually supposed to be POST but it breaks our type paradise */
9488
get: operations['propose_transaction']
@@ -296,14 +290,6 @@ export interface operations {
296290
422: unknown
297291
}
298292
}
299-
post_safe_gas_estimation_v2: {
300-
parameters: operations['post_safe_gas_estimation']['parameters']
301-
responses: Omit<operations['post_safe_gas_estimation']['responses'], 200> & {
302-
200: {
303-
schema: SafeTransactionEstimationV2
304-
}
305-
}
306-
}
307293
propose_transaction: {
308294
parameters: {
309295
path: {

src/types/transactions.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,8 @@ export type SafeTransactionEstimationRequest = {
328328
operation: Operation
329329
}
330330

331+
// CGW v2 response
331332
export type SafeTransactionEstimation = {
332-
latestNonce: number
333-
safeTxGas: string
334-
}
335-
336-
export type SafeTransactionEstimationV2 = {
337333
currentNonce: number
338334
recommendedNonce: number
339335
safeTxGas: string

0 commit comments

Comments
 (0)