Skip to content

Commit 49d4494

Browse files
authored
Fix(Marketplace): Increase gas on writes (#2951)
1 parent 44680c6 commit 49d4494

File tree

10 files changed

+25
-1
lines changed

10 files changed

+25
-1
lines changed

.changeset/fair-snakes-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Increase gas on MarketplaceV3 writes

packages/thirdweb/src/extensions/marketplace/direct-listings/write/buyFromListing.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function buyFromListing(
5959
value: isNativeTokenAddress(listing.currencyContractAddress)
6060
? listing.pricePerToken * options.quantity
6161
: 0n,
62+
extraGas: 50_000n, // add extra gas to account for router call
6263
},
6364
};
6465
},

packages/thirdweb/src/extensions/marketplace/direct-listings/write/createListing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ export function createListing(
167167
endTimestamp,
168168
reserved: options.isReservedListing ?? false,
169169
},
170+
overrides: {
171+
extraGas: 50_000n, // add extra gas to account for router call
172+
},
170173
} as const;
171174
},
172175
});

packages/thirdweb/src/extensions/marketplace/direct-listings/write/updateListing.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ export function updateListing(
190190
endTimestamp,
191191
reserved: mergedOptions.isReservedListing ?? false,
192192
},
193+
overrides: {
194+
extraGas: 50_000n, // add extra gas to account for router call
195+
},
193196
} as const;
194197
},
195198
});

packages/thirdweb/src/extensions/marketplace/english-auctions/write/bidInAuction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export function bidInAuction(
9494
value: isNativeTokenAddress(auction.currencyContractAddress)
9595
? resolvedBidAmountWei
9696
: undefined,
97+
extraGas: 50_000n, // add extra gas to account for router call
9798
},
9899
};
99100
},

packages/thirdweb/src/extensions/marketplace/english-auctions/write/buyoutAuction.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function buyoutAuction(
4040
value: isNativeTokenAddress(auction.currencyContractAddress)
4141
? auction.buyoutBidAmount
4242
: undefined,
43+
extraGas: 50_000n, // add extra gas to account for router call
4344
},
4445
};
4546
},

packages/thirdweb/src/extensions/marketplace/english-auctions/write/cancelAuction.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export function cancelAuction(
3838
}
3939
return {
4040
auctionId: options.auctionId,
41+
overrides: {
42+
extraGas: 50_000n, // add extra gas to account for router call
43+
},
4144
};
4245
},
4346
});

packages/thirdweb/src/extensions/marketplace/english-auctions/write/createAuction.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export function createAuction(
229229
bidBufferBps: BigInt(options.bidBufferBps ?? 500),
230230
timeBufferInSeconds: BigInt(options.timeBufferInSeconds ?? 900),
231231
},
232+
overrides: {
233+
extraGas: 50_000n, // add extra gas to account for router call
234+
},
232235
} as const;
233236
},
234237
});

packages/thirdweb/src/extensions/marketplace/english-auctions/write/executeSale.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export function executeSale(
4444
encodeCollectAuctionTokens({ auctionId: options.auctionId }),
4545
encodeCollectAuctionPayout({ auctionId: options.auctionId }),
4646
],
47+
overrides: {
48+
extraGas: 50_000n, // add extra gas to account for router call
49+
},
4750
};
4851
},
4952
});

packages/thirdweb/src/react/web/ui/TransactionButton/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from "../../../../transaction/actions/wait-for-tx-receipt.js";
88
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
99
import type { TransactionReceipt } from "../../../../transaction/types.js";
10+
import { stringify } from "../../../../utils/json.js";
1011
import {
1112
useActiveAccount,
1213
useActiveWallet,
@@ -167,7 +168,7 @@ export function TransactionButton(props: TransactionButtonProps) {
167168
const receipt = await doWaitForReceipt(result);
168169
if (receipt.status === "reverted")
169170
throw new Error(
170-
`Execution reverted: ${JSON.stringify(receipt, null, 2)}`,
171+
`Execution reverted: ${stringify(receipt, null, 2)}`,
171172
);
172173
onTransactionConfirmed(receipt);
173174
}

0 commit comments

Comments
 (0)