Skip to content

Commit 66310b5

Browse files
authored
fix: remove incorrect guard (thrown error) from presign fn (#100)
1 parent 50b615f commit 66310b5

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/sdk/v4/NftSwapV4.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,10 @@ class NftSwapV4 implements INftSwapV4 {
915915
console.log('unsupported order', signedOrder);
916916
throw new Error('unsupport signedOrder type');
917917
};
918+
918919
/**
919-
* Pre-signs and submits an order
920+
* Pre-signs and submits signed order on chain (use this to sign orders for smart contract wallets)
921+
* Presigned on-chain transaction will emit an event that is indexable w/ the full fillable order
920922
* @param signedOrder An unsigned 0x v4 order
921923
* @param fillOrderOverrides Optional configuration on possible ways to fill the order
922924
* @param transactionOverrides Ethers transaction overrides (e.g. gas price)
@@ -927,34 +929,19 @@ class NftSwapV4 implements INftSwapV4 {
927929
fillOrderOverrides?: Partial<FillOrderOverrides>,
928930
transactionOverrides?: Partial<PayableOverrides>
929931
) => {
930-
// Only Sell orders can be filled with ETH
931-
const canOrderTypeBeFilledWithNativeToken =
932-
order.direction === TradeDirection.SellNFT;
933-
// Is ERC20 being traded the native token
934-
const isNativeToken = this.isErc20NativeToken(order);
935-
const needsEthAttached =
936-
isNativeToken && canOrderTypeBeFilledWithNativeToken;
937-
if (needsEthAttached) {
938-
console.log(
939-
"can't pre-sign orders that need to be filled with ETH",
940-
order
941-
);
942-
throw new Error("can't pre-sign orders that need to be filled with ETH");
943-
}
944-
// do fill
932+
// Do pre-sign
945933
if ('erc1155Token' in order) {
946934
// If maker is selling an NFT, taker wants to 'buy' nft
947935
if (
948936
order.direction === TradeDirection.BuyNFT &&
949937
order.erc1155TokenProperties.length > 0 &&
950938
fillOrderOverrides?.tokenIdToSellForCollectionOrder === undefined
951939
) {
952-
// property based order, let's make sure they've specifically provided a tokenIdToSellForCollectionOrder
940+
// Property based order, let's make sure they've specifically provided a tokenIdToSellForCollectionOrder
953941
throw new Error(
954942
'Collection order missing NFT tokenId to fill with. Specify in fillOrderOverrides.tokenIdToSellForCollectionOrder'
955943
);
956944
}
957-
958945
return this.exchangeProxy.preSignERC1155Order(order, {
959946
...transactionOverrides,
960947
});
@@ -975,7 +962,7 @@ class NftSwapV4 implements INftSwapV4 {
975962
...transactionOverrides,
976963
});
977964
}
978-
console.log('unsupported order', order);
965+
warning('Unsupported order', order);
979966
throw new Error('unsupport signedOrder type');
980967
};
981968

test/v4/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('NFTSwapV4', () => {
5050
it('classifies contract wallet correctly (gnosis multisig)', async () => {
5151
const isContractWallet = await checkIfContractWallet(
5252
PROVIDER,
53-
'0x618F9C67CE7Bf1a50afa1E7e0238422601b0ff6e' // 0x governor multisig
53+
'0x618F9C67CE7Bf1a50afa1E7e0238422601b0ff6e' // 0x governor multisig
5454
);
5555
expect(isContractWallet).toBe(true);
5656
});

0 commit comments

Comments
 (0)