Skip to content

Commit df3a378

Browse files
committed
fix(SafeTypes): update Safe transactions type
1 parent 20121da commit df3a378

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

components/Transaction/SafeTransactionCreator.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ export default function SafeTransactionCreator({
5454
}
5555

5656
useEffect(() => {
57-
const _historyTxs = historyTxs as any;
58-
if (nonce === "" && _historyTxs?.countUniqueNonce) {
59-
setNonce(_historyTxs.countUniqueNonce.toString());
57+
if (nonce === "" && historyTxs?.results.length) {
58+
setNonce(historyTxs?.results.length.toString());
6059
}
6160
}, [historyTxs]);
6261

@@ -88,7 +87,7 @@ export default function SafeTransactionCreator({
8887
<input
8988
type="number"
9089
step={1}
91-
min={historyTxs?.count || 0}
90+
min={historyTxs?.results.length || 0}
9291
value={nonce}
9392
onChange={(e) => setNonce(e.target.value)}
9493
className="relative -ml-px inline-flex w-20 items-center rounded-r-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-10"

models/SafeTypes.ts

+19
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,22 @@ export interface SafeTransactionBuilderTxn {
123123
string
124124
>;
125125
}
126+
127+
export interface SafetransactionsResponseResult {
128+
transaction: {
129+
// multisig_0xAF28bcB48C40dBC86f52D459A6562F658fc94B1e
130+
// _0x2b2a3167b4912af385fd1f6096e752e1b6cd91acb2bfb07914851399b03637cd
131+
id: string;
132+
timestamp: number;
133+
txHash: string;
134+
};
135+
}
136+
137+
export interface SafeTransactionsResponse {
138+
// https://safe-client.safe.global/v1/chains/1/safes
139+
// /0xAF28bcB48C40dBC86f52D459A6562F658fc94B1e/multisig-transactions
140+
// /?trusted=true&limit=10&cursor=limit%3D20%26offset%3D20
141+
next: string;
142+
previous: string;
143+
results: SafetransactionsResponseResult[];
144+
}

utils/hooks/Safe/SafeFetchers.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
SafeInfoResponse,
3-
SafeDelegatesResponse
3+
SafeDelegatesResponse,
4+
SafeTransactionsResponse,
45
} from "@/models/SafeTypes";
5-
import { SafeMultisigTransactionListResponse } from "@safe-global/api-kit";
66
import { Fetcher } from "swr";
77

88
export function basicFetcher(): Fetcher<any, string> {
@@ -14,7 +14,7 @@ export function basicFetcher(): Fetcher<any, string> {
1414
};
1515
}
1616

17-
export function jsonFetcher(): Fetcher<SafeMultisigTransactionListResponse, string> {
17+
export function jsonFetcher(): Fetcher<SafeTransactionsResponse, string> {
1818
return async (url) => {
1919
const res = await fetch(url);
2020
if (res.status == 400) {

0 commit comments

Comments
 (0)