Skip to content

Commit 8edb398

Browse files
authored
fix: cancel nonces in ascending order (#630)
1 parent d5f7e6e commit 8edb398

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

src/server/routes/backend-wallet/withdraw.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { FastifyInstance } from "fastify";
33
import { StatusCodes } from "http-status-codes";
44
import {
55
Address,
6-
defineChain,
76
estimateGasCost,
87
prepareTransaction,
98
sendTransaction,
@@ -68,7 +67,7 @@ export async function withdraw(fastify: FastifyInstance) {
6867
} = request.headers as Static<typeof walletHeaderSchema>;
6968

7069
const chainId = await getChainIdFromChain(chainQuery);
71-
const chain = defineChain(chainId);
70+
const chain = await getChain(chainId);
7271
const from = walletAddress as Address;
7372

7473
const account = await getAccount({ chainId, from });

src/server/routes/contract/extensions/erc721/write/signatureMint.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ import { SignedPayload721WithQuantitySignature } from "@thirdweb-dev/sdk";
33
import { BigNumber } from "ethers";
44
import { FastifyInstance } from "fastify";
55
import { StatusCodes } from "http-status-codes";
6-
import {
7-
Address,
8-
Hex,
9-
defineChain,
10-
getContract as getContractV5,
11-
} from "thirdweb";
6+
import { Address, Hex, getContract as getContractV5 } from "thirdweb";
127
import { mintWithSignature } from "thirdweb/extensions/erc721";
138
import { resolvePromisedValue } from "thirdweb/utils";
149
import { queueTx } from "../../../../../../db/transactions/queueTx";
1510
import { getContract } from "../../../../../../utils/cache/getContract";
11+
import { getChain } from "../../../../../../utils/chain";
1612
import { maybeBigInt } from "../../../../../../utils/primitiveTypes";
1713
import { thirdwebClient } from "../../../../../../utils/sdk";
1814
import { insertTransaction } from "../../../../../../utils/transaction/insertTransaction";
@@ -103,7 +99,7 @@ export async function erc721SignatureMint(fastify: FastifyInstance) {
10399
const payloadV5 = payload as Static<typeof signature721OutputSchemaV5>;
104100
const contract = getContractV5({
105101
client: thirdwebClient,
106-
chain: defineChain(chainId),
102+
chain: await getChain(chainId),
107103
address: contractAddress,
108104
});
109105
const transaction = mintWithSignature({

src/worker/tasks/cancelRecycledNoncesWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ const getAndDeleteUnusedNonces = async (key: string) => {
8888
if (error) {
8989
throw new Error(`Error getting members of ${key}: ${error}`);
9090
}
91-
return (nonces as string[]).map((v) => parseInt(v));
91+
return (nonces as string[]).map((v) => parseInt(v)).sort();
9292
};

0 commit comments

Comments
 (0)