File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
packages/thirdweb/src/extensions Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Fix 721/1155 claimTo
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { BaseTransactionOptions } from "../../../../transaction/types.js";
3
3
import { prepareContractCall } from "../../../../transaction/prepare-contract-call.js" ;
4
4
import { getActiveClaimCondition } from "../read/getActiveClaimCondition.js" ;
5
5
import { padHex } from "../../../../utils/encoding/hex.js" ;
6
+ import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js" ;
6
7
7
8
const CLAIM_ABI = {
8
9
inputs : [
@@ -129,7 +130,11 @@ export function claimTo(options: BaseTransactionOptions<ClaimToParams>) {
129
130
contract : options . contract ,
130
131
tokenId : options . tokenId ,
131
132
} ) ;
132
- return cc . pricePerToken * BigInt ( options . quantity ) ;
133
+ if ( cc . currency === NATIVE_TOKEN_ADDRESS ) {
134
+ return cc . pricePerToken * BigInt ( options . quantity ) ;
135
+ } else {
136
+ return 0n ;
137
+ }
133
138
} ,
134
139
} ) ;
135
140
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { BaseTransactionOptions } from "../../../../transaction/types.js";
3
3
import { prepareContractCall } from "../../../../transaction/prepare-contract-call.js" ;
4
4
import { getActiveClaimCondition } from "../read/getActiveClaimCondition.js" ;
5
5
import { padHex } from "../../../../utils/encoding/hex.js" ;
6
+ import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js" ;
6
7
/**
7
8
* Represents the parameters for claiming an ERC721 token.
8
9
*/
@@ -117,7 +118,11 @@ export function claimTo(options: BaseTransactionOptions<ClaimToParams>) {
117
118
const cc = await getActiveClaimCondition ( {
118
119
contract : options . contract ,
119
120
} ) ;
120
- return cc . pricePerToken * BigInt ( options . quantity ) ;
121
+ if ( cc . currency === NATIVE_TOKEN_ADDRESS ) {
122
+ return cc . pricePerToken * BigInt ( options . quantity ) ;
123
+ } else {
124
+ return 0n ;
125
+ }
121
126
} ,
122
127
} ) ;
123
128
}
You can’t perform that action at this time.
0 commit comments