Skip to content

Commit db43843

Browse files
authored
chore: update viem (#57)
1 parent afad243 commit db43843

File tree

83 files changed

+32057
-33368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+32057
-33368
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"enquirer": "^2.4.1",
2121
"express": "^4.19.2",
2222
"tsc-watch": "^6.0.4",
23-
"viem": "^1.16.6",
23+
"viem": "^2.17.4",
2424
"yup": "^1.3.2"
2525
},
2626
"devDependencies": {

services/decoder/fallbacks/approval-for-all/abis/approval-for-all.abi.json

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const approvalForAllABI = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
internalType: "address",
8+
name: "owner",
9+
type: "address",
10+
},
11+
{
12+
indexed: true,
13+
internalType: "address",
14+
name: "operator",
15+
type: "address",
16+
},
17+
{
18+
indexed: false,
19+
internalType: "bool",
20+
name: "approved",
21+
type: "bool",
22+
},
23+
],
24+
name: "ApprovalForAll",
25+
type: "event",
26+
},
27+
] as const;

services/decoder/fallbacks/approval-for-all/approval-for-all.fallback.ts

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { decodeEventLog, type Abi } from "viem";
12
import { GoldRushDecoder } from "../../decoder";
2-
import { type EventType } from "../../decoder.types";
33
import {
44
DECODED_ACTION,
55
DECODED_EVENT_CATEGORY,
66
} from "../../decoder.constants";
7-
import { decodeEventLog, type Abi } from "viem";
8-
import ABI from "./abis/approval-for-all.abi.json";
7+
import { type EventType } from "../../decoder.types";
8+
import { approvalForAllABI } from "./abis/approval-for-all.abi";
99

1010
GoldRushDecoder.fallback(
1111
"ApprovalForAll",
12-
ABI as Abi,
12+
approvalForAllABI as Abi,
1313
async (
1414
log_event,
1515
tx,
@@ -21,18 +21,11 @@ GoldRushDecoder.fallback(
2121
log_event;
2222

2323
const { args: decoded } = decodeEventLog({
24-
abi: ABI,
24+
abi: approvalForAllABI,
2525
topics: raw_log_topics as [],
2626
data: raw_log_data as `0x${string}`,
2727
eventName: "ApprovalForAll",
28-
}) as {
29-
eventName: "ApprovalForAll";
30-
args: {
31-
owner: string;
32-
operator: string;
33-
approved: boolean;
34-
};
35-
};
28+
});
3629

3730
return {
3831
action: DECODED_ACTION.APPROVAL,

services/decoder/fallbacks/approval/abis/approval-erc20.abi.json

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const approvalERC20ABI = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
name: "owner",
8+
type: "address",
9+
},
10+
{
11+
indexed: true,
12+
name: "spender",
13+
type: "address",
14+
},
15+
{
16+
indexed: false,
17+
name: "value",
18+
type: "uint256",
19+
},
20+
],
21+
name: "Approval",
22+
type: "event",
23+
},
24+
] as const;

services/decoder/fallbacks/approval/abis/approval-erc721.abi.json

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const approvalERC721ABI = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
name: "owner",
8+
type: "address",
9+
},
10+
{
11+
indexed: true,
12+
name: "spender",
13+
type: "address",
14+
},
15+
{
16+
indexed: true,
17+
name: "tokenId",
18+
type: "uint256",
19+
},
20+
],
21+
name: "Approval",
22+
type: "event",
23+
},
24+
] as const;

services/decoder/fallbacks/approval/approval.fallback.ts

+11-25
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
import { prettifyCurrency } from "@covalenthq/client-sdk";
2+
import { decodeEventLog, type Abi } from "viem";
3+
import { currencyToNumber, timestampParser } from "../../../../utils/functions";
14
import { GoldRushDecoder } from "../../decoder";
2-
import { type EventDetails, type EventType } from "../../decoder.types";
35
import {
46
DECODED_ACTION,
57
DECODED_EVENT_CATEGORY,
68
} from "../../decoder.constants";
7-
import { decodeEventLog, type Abi } from "viem";
8-
import ERC20ABI from "./abis/approval-erc20.abi.json";
9-
import ERC721ABI from "./abis/approval-erc721.abi.json";
10-
import { currencyToNumber, timestampParser } from "../../../../utils/functions";
11-
import { prettifyCurrency } from "@covalenthq/client-sdk";
9+
import { type EventDetails, type EventType } from "../../decoder.types";
10+
import { approvalERC20ABI } from "./abis/approval-erc20.abi";
11+
import { approvalERC721ABI } from "./abis/approval-erc721.abi";
1212

1313
GoldRushDecoder.fallback(
1414
"Approval",
15-
ERC20ABI as Abi,
15+
approvalERC20ABI as Abi,
1616
async (
1717
log_event,
1818
tx,
@@ -47,33 +47,19 @@ GoldRushDecoder.fallback(
4747

4848
try {
4949
const { args } = decodeEventLog({
50-
abi: ERC20ABI,
50+
abi: approvalERC20ABI,
5151
topics: raw_log_topics as [],
5252
data: raw_log_data as `0x${string}`,
5353
eventName: "Approval",
54-
}) as {
55-
eventName: "Approval";
56-
args: {
57-
owner: string;
58-
spender: string;
59-
value: bigint;
60-
};
61-
};
54+
});
6255
decoded = args;
6356
} catch (error) {
6457
const { args } = decodeEventLog({
65-
abi: ERC721ABI,
58+
abi: approvalERC721ABI,
6659
topics: raw_log_topics as [],
6760
data: raw_log_data as `0x${string}`,
6861
eventName: "Approval",
69-
}) as {
70-
eventName: "Approval";
71-
args: {
72-
owner: string;
73-
spender: string;
74-
tokenId: bigint;
75-
};
76-
};
62+
});
7763
decoded = args;
7864
}
7965

services/decoder/fallbacks/transfer/abis/transfer-erc20.abi.json

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const transferERC20ABI = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
internalType: "address",
8+
name: "from",
9+
type: "address",
10+
},
11+
{
12+
indexed: true,
13+
internalType: "address",
14+
name: "to",
15+
type: "address",
16+
},
17+
{
18+
indexed: false,
19+
internalType: "uint256",
20+
name: "value",
21+
type: "uint256",
22+
},
23+
],
24+
name: "Transfer",
25+
type: "event",
26+
},
27+
] as const;

services/decoder/fallbacks/transfer/abis/transfer-erc721.abi.json

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const transferERC721ABI = [
2+
{
3+
anonymous: false,
4+
inputs: [
5+
{
6+
indexed: true,
7+
internalType: "address",
8+
name: "from",
9+
type: "address",
10+
},
11+
{
12+
indexed: true,
13+
internalType: "address",
14+
name: "to",
15+
type: "address",
16+
},
17+
{
18+
indexed: true,
19+
internalType: "uint256",
20+
name: "tokenId",
21+
type: "uint256",
22+
},
23+
],
24+
name: "Transfer",
25+
type: "event",
26+
},
27+
] as const;

0 commit comments

Comments
 (0)