Skip to content

Commit d0f508a

Browse files
authored
update examples to amoy (#550)
1 parent bac0a7e commit d0f508a

File tree

9 files changed

+49
-61
lines changed

9 files changed

+49
-61
lines changed

src/server/routes/chain/get.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ const responseSchema = Type.Object({
2323
responseSchema.examples = [
2424
{
2525
result: {
26-
name: "Mumbai",
26+
name: "Polygon Amoy Testnet",
2727
chain: "Polygon",
28-
rpc: ["https://mumbai.rpc.thirdweb.com/${THIRDWEB_API_SECRET_KEY}"],
28+
rpc: ["https://80002.rpc.thirdweb.com/${THIRDWEB_API_SECRET_KEY}"],
2929
nativeCurrency: {
3030
name: "MATIC",
3131
symbol: "MATIC",
3232
decimals: 18,
3333
},
34-
shortName: "maticmum",
35-
chainId: 80001,
34+
shortName: "polygonamoy",
35+
chainId: 80002,
3636
testnet: true,
37-
slug: "mumbai",
37+
slug: "polygon-amoy-testnet",
3838
},
3939
},
4040
];

src/server/routes/transaction/blockchain/getTxReceipt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const requestSchema = Type.Object({
1515
pattern: "^0x([A-Fa-f0-9]{64})$",
1616
}),
1717
chain: Type.String({
18-
examples: ["mumbai"],
18+
examples: ["80002"],
1919
description: "Chain ID or name",
2020
}),
2121
});

src/server/routes/transaction/blockchain/getUserOpReceipt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const requestSchema = Type.Object({
1616
pattern: "^0x([A-Fa-f0-9]{64})$",
1717
}),
1818
chain: Type.String({
19-
examples: ["mumbai"],
19+
examples: ["80002"],
2020
description: "Chain ID or name",
2121
}),
2222
});

src/server/schemas/prebuilts/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const commonTrustedForwarderSchema = Type.Object({
8787

8888
export const prebuiltDeployContractParamSchema = Type.Object({
8989
chain: Type.String({
90-
examples: ["mumbai"],
90+
examples: ["80002"],
9191
description: "Chain ID or name",
9292
}),
9393
});

src/server/schemas/sharedApiSchemas.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const baseReplyErrorSchema = Type.Object({
1717
*/
1818
export const contractParamSchema = Type.Object({
1919
chain: Type.String({
20-
examples: ["mumbai"],
20+
examples: ["80002"],
2121
description: "Chain ID or name",
2222
}),
2323
contractAddress: Type.String({
@@ -37,7 +37,7 @@ export const requestQuerystringSchema = Type.Object({
3737

3838
export const prebuiltDeployParamSchema = Type.Object({
3939
chain: Type.String({
40-
examples: ["mumbai"],
40+
examples: ["80002"],
4141
description: "Chain ID or name",
4242
}),
4343
contractType: Type.String({
@@ -48,7 +48,7 @@ export const prebuiltDeployParamSchema = Type.Object({
4848

4949
export const publishedDeployParamSchema = Type.Object({
5050
chain: Type.String({
51-
examples: ["mumbai"],
51+
examples: ["80002"],
5252
description: "Chain ID or name",
5353
}),
5454
publisher: Type.String({
@@ -176,7 +176,7 @@ transactionWritesResponseSchema.example = {
176176
*/
177177
export const erc20ContractParamSchema = Type.Object({
178178
chain: Type.String({
179-
examples: ["mumbai"],
179+
examples: ["80002"],
180180
description: "Chain ID or name",
181181
}),
182182
contractAddress: Type.String({
@@ -190,7 +190,7 @@ export const erc20ContractParamSchema = Type.Object({
190190
*/
191191
export const erc1155ContractParamSchema = Type.Object({
192192
chain: Type.String({
193-
examples: ["mumbai"],
193+
examples: ["80002"],
194194
description: "Chain ID or name",
195195
}),
196196
contractAddress: Type.String({
@@ -204,7 +204,7 @@ export const erc1155ContractParamSchema = Type.Object({
204204
*/
205205
export const erc721ContractParamSchema = Type.Object({
206206
chain: Type.String({
207-
examples: ["mumbai"],
207+
examples: ["80002"],
208208
description: "Chain ID or name",
209209
}),
210210
contractAddress: Type.String({
@@ -234,7 +234,7 @@ export enum Status {
234234

235235
export const marketplaceV3ContractParamSchema = Type.Object({
236236
chain: Type.String({
237-
examples: ["mumbai"],
237+
examples: ["80002"],
238238
description: "Chain ID or name",
239239
}),
240240
contractAddress: Type.String({

src/server/schemas/wallet/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const walletWithAAHeaderSchema = Type.Object({
2323

2424
export const walletParamSchema = Type.Object({
2525
chain: Type.String({
26-
examples: ["mumbai"],
26+
examples: ["80002"],
2727
description: "Chain name",
2828
}),
2929
walletAddress: Type.String({

src/utils/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const env = createEnv({
7171
.number()
7272
.nonnegative()
7373
.default(0),
74-
REDIS_URL: z.string().optional(),
74+
REDIS_URL: z.string(),
7575
},
7676
clientPrefix: "NEVER_USED",
7777
client: {},

src/utils/redis/redis.ts

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,35 @@ import Redis from "ioredis";
22
import { env } from "../env";
33
import { logger } from "../logger";
44

5-
export let redis: Redis | null;
5+
export const redis = new Redis(env.REDIS_URL, {
6+
maxRetriesPerRequest: null,
7+
});
68

7-
if (env.REDIS_URL) {
8-
try {
9-
redis = new Redis(env.REDIS_URL, {
10-
maxRetriesPerRequest: null,
11-
});
12-
13-
redis.on("error", (err) => () => {
14-
logger({
15-
level: "error",
16-
message: `Redis error: ${err}`,
17-
service: "worker",
18-
});
19-
});
20-
redis.on("connect", () =>
21-
logger({
22-
level: "info",
23-
message: "Redis connected",
24-
service: "worker",
25-
}),
26-
);
27-
redis.on("reconnecting", () =>
28-
logger({
29-
level: "info",
30-
message: "Redis reconnecting",
31-
service: "worker",
32-
}),
33-
);
34-
redis.on("ready", () => {
35-
logger({
36-
level: "info",
37-
message: "Redis ready",
38-
service: "worker",
39-
});
40-
});
41-
} catch (e) {
42-
logger({
43-
level: "error",
44-
message: `Error initializing Redis: ${e}`,
45-
service: "worker",
46-
});
47-
}
48-
}
9+
redis.on("error", (err) => () => {
10+
logger({
11+
level: "error",
12+
message: `Redis error: ${err}`,
13+
service: "worker",
14+
});
15+
});
16+
redis.on("connect", () =>
17+
logger({
18+
level: "info",
19+
message: "Redis connected",
20+
service: "worker",
21+
}),
22+
);
23+
redis.on("reconnecting", () =>
24+
logger({
25+
level: "info",
26+
message: "Redis reconnecting",
27+
service: "worker",
28+
}),
29+
);
30+
redis.on("ready", () => {
31+
logger({
32+
level: "info",
33+
message: "Redis ready",
34+
service: "worker",
35+
});
36+
});

src/worker/tasks/processTransactionReceiptsWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const getFormattedTransactionReceipts = async ({
186186
transactionIndex: receipt.transactionIndex,
187187
gasUsed: receipt.gasUsed.toString(),
188188
effectiveGasPrice: receipt.effectiveGasPrice.toString(),
189-
status: receipt.status ? 1 : 0,
189+
status: receipt.status === "success" ? 1 : 0,
190190
});
191191
}
192192

0 commit comments

Comments
 (0)