@0xsequence/marketplace-sdk 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-D3HRXVYJ.js → chunk-3LOJQCTV.js} +2 -2
- package/dist/{chunk-53Q7BNZH.js → chunk-4FC3IG7C.js} +2 -2
- package/dist/{chunk-T2AMWIKD.js → chunk-E3ZFT6WR.js} +7 -7
- package/dist/chunk-E3ZFT6WR.js.map +1 -0
- package/dist/{chunk-OUZ42I6B.js → chunk-KRMV6FJE.js} +2 -2
- package/dist/{chunk-G2FYRJMK.js → chunk-N5F6IEAK.js} +1 -1
- package/dist/chunk-N5F6IEAK.js.map +1 -0
- package/dist/{chunk-QGELCUYG.js → chunk-OQDNL7UW.js} +31 -24
- package/dist/chunk-OQDNL7UW.js.map +1 -0
- package/dist/{chunk-3LGNSRBR.js → chunk-VOSDZXYO.js} +403 -265
- package/dist/chunk-VOSDZXYO.js.map +1 -0
- package/dist/{chunk-3CXEYH2I.js → chunk-Z7NLKEXF.js} +2 -2
- package/dist/index.js +9 -9
- package/dist/react/_internal/api/index.js +2 -2
- package/dist/react/_internal/index.js +3 -3
- package/dist/react/_internal/wagmi/index.js +2 -2
- package/dist/react/hooks/index.d.ts +70 -13
- package/dist/react/hooks/index.js +6 -6
- package/dist/react/index.js +7 -7
- package/dist/react/ssr/index.js.map +1 -1
- package/dist/react/ui/components/index.d.ts +3 -2
- package/dist/react/ui/components/index.js +7 -7
- package/dist/react/ui/index.d.ts +3 -1
- package/dist/react/ui/index.js +7 -7
- package/dist/react/ui/modals/_internal/components/actionModal/index.js +3 -3
- package/dist/types/index.js +3 -3
- package/dist/utils/abi/index.js +5 -5
- package/dist/utils/index.js +7 -7
- package/package.json +1 -1
- package/src/react/_internal/transaction-machine/execute-transaction.ts +14 -3
- package/src/react/_internal/transaction-machine/useTransactionMachine.ts +6 -8
- package/src/react/hooks/useBuyCollectable.tsx +2 -1
- package/src/react/hooks/useCancelOrder.tsx +2 -1
- package/src/react/hooks/useCurrencies.tsx +23 -22
- package/src/react/hooks/useCurrencyBalance.tsx +52 -0
- package/src/react/hooks/useCurrencyOptions.tsx +16 -0
- package/src/react/hooks/useSell.tsx +2 -1
- package/src/react/ui/components/_internals/action-button/ActionButton.tsx +5 -1
- package/src/react/ui/components/collectible-card/CollectibleCard.tsx +8 -1
- package/src/react/ui/components/collectible-card/Footer.tsx +20 -14
- package/src/react/ui/modals/BuyModal/index.tsx +6 -3
- package/src/react/ui/modals/CreateListingModal/_store.ts +4 -1
- package/src/react/ui/modals/CreateListingModal/index.tsx +14 -2
- package/src/react/ui/modals/MakeOfferModal/_store.ts +5 -1
- package/src/react/ui/modals/MakeOfferModal/index.tsx +17 -4
- package/src/react/ui/modals/SellModal/index.tsx +3 -2
- package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +53 -0
- package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +14 -9
- package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
- package/src/react/ui/modals/_internal/components/priceInput/index.tsx +12 -13
- package/src/utils/_internal/error/transaction.ts +12 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/chunk-3LGNSRBR.js.map +0 -1
- package/dist/chunk-G2FYRJMK.js.map +0 -1
- package/dist/chunk-QGELCUYG.js.map +0 -1
- package/dist/chunk-T2AMWIKD.js.map +0 -1
- /package/dist/{chunk-D3HRXVYJ.js.map → chunk-3LOJQCTV.js.map} +0 -0
- /package/dist/{chunk-53Q7BNZH.js.map → chunk-4FC3IG7C.js.map} +0 -0
- /package/dist/{chunk-OUZ42I6B.js.map → chunk-KRMV6FJE.js.map} +0 -0
- /package/dist/{chunk-3CXEYH2I.js.map → chunk-Z7NLKEXF.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import {
|
|
3
3
|
MissingConfigError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-E3ZFT6WR.js";
|
|
5
5
|
|
|
6
6
|
// src/react/_internal/api/get-query-client.ts
|
|
7
7
|
import {
|
|
@@ -1349,4 +1349,4 @@ export {
|
|
|
1349
1349
|
getIndexerClient,
|
|
1350
1350
|
getMarketplaceClient
|
|
1351
1351
|
};
|
|
1352
|
-
//# sourceMappingURL=chunk-
|
|
1352
|
+
//# sourceMappingURL=chunk-3LOJQCTV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MissingConfigError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N5F6IEAK.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/address.ts
|
|
6
6
|
var truncateMiddle = (address, minPrefix = 20, minSuffix = 3) => {
|
|
@@ -83,4 +83,4 @@ export {
|
|
|
83
83
|
getPresentableChainName,
|
|
84
84
|
calculatePriceDifferencePercentage
|
|
85
85
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
86
|
+
//# sourceMappingURL=chunk-4FC3IG7C.js.map
|
|
@@ -167,11 +167,11 @@ var InvalidContractTypeError = class extends TransactionError {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
-
var
|
|
171
|
-
name = "
|
|
172
|
-
constructor(
|
|
173
|
-
super(`
|
|
174
|
-
details: "The
|
|
170
|
+
var InvalidCurrencyOptionsError = class extends TransactionError {
|
|
171
|
+
name = "InvalidCurrencyOptionsError";
|
|
172
|
+
constructor(currencyOptions) {
|
|
173
|
+
super(`Invalid currency options: ${currencyOptions}`, {
|
|
174
|
+
details: "The currency options must be an array of valid currency contract addresses."
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
};
|
|
@@ -264,7 +264,7 @@ export {
|
|
|
264
264
|
NoStepsFoundError,
|
|
265
265
|
UnknownTransactionTypeError,
|
|
266
266
|
InvalidContractTypeError,
|
|
267
|
-
|
|
267
|
+
InvalidCurrencyOptionsError,
|
|
268
268
|
ProjectNotFoundError,
|
|
269
269
|
MarketplaceConfigFetchError,
|
|
270
270
|
MissingConfigError,
|
|
@@ -274,4 +274,4 @@ export {
|
|
|
274
274
|
CheckoutOptionsError,
|
|
275
275
|
OrdersFetchError
|
|
276
276
|
};
|
|
277
|
-
//# sourceMappingURL=chunk-
|
|
277
|
+
//# sourceMappingURL=chunk-E3ZFT6WR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/_internal/error/base.ts","../src/utils/_internal/error/transaction.ts"],"sourcesContent":["export type ErrorType<name extends string = 'Error'> = Error & { name: name };\n\nexport type Compute<type> = { [key in keyof type]: type[key] } & unknown;\n\ntype BaseErrorOptions = Compute<\n\t{ details?: string | undefined } | { cause: BaseError | Error }\n>;\n\nexport class BaseError extends Error {\n\tdetails: string;\n\tshortMessage: string;\n\n\tname = 'MarketplaceSdkBaseError';\n\n\tconstructor(shortMessage: string, options: BaseErrorOptions = {}) {\n\t\tsuper();\n\n\t\tconst details = 'details' in options ? options.details : '';\n\t\tthis.message = [\n\t\t\tshortMessage || 'An error occurred.',\n\t\t\t'',\n\t\t\t...(details ? [`Details: ${details}`] : []),\n\t\t].join('\\n');\n\n\t\tif ('cause' in options && options.cause) {\n\t\t\tthis.cause = options.cause;\n\t\t}\n\n\t\tthis.details = details || '';\n\t\tthis.shortMessage = shortMessage;\n\t}\n}\n","import { Address } from 'viem';\nimport { BaseError } from './base';\n\nexport type TransactionErrorType<name extends string = 'TransactionError'> =\n\tBaseError & { name: name };\n\nexport class TransactionError extends BaseError {\n\toverride name = 'TransactionError';\n}\n\nexport class ChainSwitchError extends TransactionError {\n\toverride name = 'ChainSwitchError';\n\tconstructor(currentChainId: number, targetChainId: number) {\n\t\tsuper(\n\t\t\t`Failed to switch network from ${currentChainId} to ${targetChainId}`,\n\t\t\t{\n\t\t\t\tdetails:\n\t\t\t\t\t'The user may have rejected the network switch or there might be a network connectivity issue.',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport class TransactionExecutionError extends TransactionError {\n\toverride name = 'TransactionExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction may have been rejected or failed during execution.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class TransactionSignatureError extends TransactionError {\n\toverride name = 'TransactionSignatureError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to sign transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The signature request may have been rejected by the user.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class NoWalletConnectedError extends TransactionError {\n\toverride name = 'NoWalletConnectedError';\n\tconstructor() {\n\t\tsuper('No wallet connected', {\n\t\t\tdetails: 'Please connect your wallet before attempting this transaction.',\n\t\t});\n\t}\n}\n\nexport class NoMarketplaceConfigError extends TransactionError {\n\toverride name = 'NoMarketplaceConfigError';\n\tconstructor() {\n\t\tsuper('Marketplace configuration not found', {\n\t\t\tdetails:\n\t\t\t\t'The marketplace configuration is missing or invalid. This could be due to an initialization error.',\n\t\t});\n\t}\n}\n\nexport class UserRejectedRequestError extends TransactionError {\n\toverride name = 'UserRejectedRequestError';\n\tconstructor() {\n\t\tsuper('User rejected the request', {\n\t\t\tdetails: 'The user cancelled or rejected the transaction request.',\n\t\t});\n\t}\n}\n\nexport class InsufficientFundsError extends TransactionError {\n\toverride name = 'InsufficientFundsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Insufficient funds for transaction', {\n\t\t\tdetails:\n\t\t\t\t'The wallet does not have enough funds to complete this transaction.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepExecutionError extends TransactionError {\n\toverride name = 'StepExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute step ${stepId})`, {\n\t\t\tdetails: cause?.message || 'The step execution failed unexpectedly.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepGenerationError extends TransactionError {\n\toverride name = 'StepGenerationError';\n\tconstructor(transactionType: string, cause?: Error) {\n\t\tsuper(`Failed to generate steps for ${transactionType}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'Could not generate the required transaction steps.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalError extends TransactionError {\n\toverride name = 'PaymentModalError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Payment modal operation failed', {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'The payment modal operation was unsuccessful.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class InvalidStepError extends TransactionError {\n\toverride name = 'InvalidStepError';\n\tconstructor(stepId: string, reason: string) {\n\t\tsuper(`Invalid step configuration for ${stepId}`, {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class TransactionConfirmationError extends TransactionError {\n\toverride name = 'TransactionConfirmationError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to confirm transaction ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction could not be confirmed on the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrderNotFoundError extends TransactionError {\n\toverride name = 'OrderNotFoundError';\n\tconstructor(orderId: string) {\n\t\tsuper(`Order ${orderId} not found`, {\n\t\t\tdetails: 'The requested order could not be found in the marketplace.',\n\t\t});\n\t}\n}\n\nexport class MissingStepDataError extends TransactionError {\n\toverride name = 'MissingStepDataError';\n\tconstructor() {\n\t\tsuper('Step is missing required data', {\n\t\t\tdetails:\n\t\t\t\t'The transaction step is missing required \"to\" or \"signature\" data.',\n\t\t});\n\t}\n}\n\nexport class MissingSignatureDataError extends TransactionError {\n\toverride name = 'MissingSignatureDataError';\n\tconstructor() {\n\t\tsuper('Step is missing signature data', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required signature data configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidSignatureStepError extends TransactionError {\n\toverride name = 'InvalidSignatureStepError';\n\tconstructor(stepId: string) {\n\t\tsuper(`Invalid signature step type: ${stepId}`, {\n\t\t\tdetails: 'The signature step type is not supported.',\n\t\t});\n\t}\n}\n\nexport class MissingPostStepError extends TransactionError {\n\toverride name = 'MissingPostStepError';\n\tconstructor() {\n\t\tsuper('Missing post step configuration', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required post-step configuration.',\n\t\t});\n\t}\n}\n\nexport class UnexpectedStepsError extends TransactionError {\n\toverride name = 'UnexpectedStepsError';\n\tconstructor() {\n\t\tsuper('Unexpected steps found', {\n\t\t\tdetails: 'The transaction contains more steps than expected.',\n\t\t});\n\t}\n}\n\nexport class NoExecutionStepError extends TransactionError {\n\toverride name = 'NoExecutionStepError';\n\tconstructor() {\n\t\tsuper('No execution step found', {\n\t\t\tdetails: 'The transaction is missing the required execution step.',\n\t\t});\n\t}\n}\n\nexport class NoStepsFoundError extends TransactionError {\n\toverride name = 'NoStepsFoundError';\n\tconstructor() {\n\t\tsuper('No steps found', {\n\t\t\tdetails: 'The transaction contains no steps to execute.',\n\t\t});\n\t}\n}\n\nexport class UnknownTransactionTypeError extends TransactionError {\n\toverride name = 'UnknownTransactionTypeError';\n\tconstructor(type: string) {\n\t\tsuper(`Unknown transaction type: ${type}`, {\n\t\t\tdetails: 'The specified transaction type is not supported.',\n\t\t});\n\t}\n}\n\nexport class InvalidContractTypeError extends TransactionError {\n\toverride name = 'InvalidContractTypeError';\n\tconstructor(contractType: string | undefined) {\n\t\tsuper(`Invalid contract type: ${contractType}`, {\n\t\t\tdetails: 'The contract type must be either ERC721 or ERC1155.',\n\t\t});\n\t}\n}\n\nexport class CollectionNotFoundError extends TransactionError {\n\toverride name = 'CollectionNotFoundError';\n\tconstructor(collectionAddress: string) {\n\t\tsuper(`Collection not found: ${collectionAddress}`, {\n\t\t\tdetails:\n\t\t\t\t'The specified collection address could not be found in the marketplace configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidCurrencyOptionsError extends TransactionError {\n\toverride name = 'InvalidCurrencyOptionsError';\n\tconstructor(currencyOptions: Address[]) {\n\t\tsuper(`Invalid currency options: ${currencyOptions}`, {\n\t\t\tdetails:\n\t\t\t\t'The currency options must be an array of valid currency contract addresses.',\n\t\t});\n\t}\n}\n\nexport class ProjectNotFoundError extends TransactionError {\n\toverride name = 'ProjectNotFoundError';\n\tconstructor(projectId: string, url: string) {\n\t\tsuper(`Project not found`, {\n\t\t\tdetails: `Project id: ${projectId} not found at ${url}`,\n\t\t});\n\t}\n}\n\nexport class MarketplaceConfigFetchError extends TransactionError {\n\toverride name = 'MarketplaceConfigFetchError';\n\tconstructor(message: string) {\n\t\tsuper('Failed to fetch marketplace config', {\n\t\t\tdetails: message,\n\t\t});\n\t}\n}\n\nexport class MissingConfigError extends TransactionError {\n\toverride name = 'MissingConfigError';\n\tconstructor(configName: string) {\n\t\tsuper(`Missing required config: ${configName}`, {\n\t\t\tdetails: 'A required configuration parameter is missing.',\n\t\t});\n\t}\n}\n\nexport class TransactionValidationError extends TransactionError {\n\toverride name = 'TransactionValidationError';\n\tconstructor(reason: string) {\n\t\tsuper('Transaction validation failed', {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class ChainIdUnavailableError extends TransactionError {\n\toverride name = 'ChainIdUnavailableError';\n\tconstructor() {\n\t\tsuper('Chain ID is not available', {\n\t\t\tdetails: 'Could not determine the current chain ID from the wallet.',\n\t\t});\n\t}\n}\n\nexport class TransactionReceiptError extends TransactionError {\n\toverride name = 'TransactionReceiptError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to get transaction receipt for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the transaction receipt from the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalTransactionError extends TransactionError {\n\toverride name = 'PaymentModalTransactionError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Payment modal transaction failed for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction initiated from the payment modal failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class CheckoutOptionsError extends TransactionError {\n\toverride name = 'CheckoutOptionsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Failed to get checkout options', {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the checkout options from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrdersFetchError extends TransactionError {\n\toverride name = 'OrdersFetchError';\n\tconstructor(orderId: string, cause?: Error) {\n\t\tsuper(`Failed to fetch order ${orderId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the order details from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport type TransactionErrorTypes =\n\t| ChainIdUnavailableError\n\t| TransactionReceiptError\n\t| PaymentModalTransactionError\n\t| CheckoutOptionsError\n\t| OrdersFetchError\n\t| TransactionConfirmationError\n\t| TransactionValidationError\n\t| MissingConfigError\n\t| MarketplaceConfigFetchError\n\t| ProjectNotFoundError\n\t| CollectionNotFoundError\n\t| InvalidCurrencyOptionsError\n\t| InvalidContractTypeError\n\t| UnknownTransactionTypeError\n\t| NoStepsFoundError\n\t| NoExecutionStepError\n\t| UnexpectedStepsError\n\t| MissingPostStepError\n\t| InvalidSignatureStepError\n\t| MissingSignatureDataError\n\t| MissingStepDataError\n\t| OrderNotFoundError\n\t| TransactionConfirmationError\n\t| InvalidStepError\n\t| PaymentModalError\n\t| StepGenerationError\n\t| StepExecutionError\n\t| UserRejectedRequestError\n\t| NoMarketplaceConfigError\n\t| InsufficientFundsError\n\t| ChainSwitchError\n\t| TransactionSignatureError\n\t| TransactionExecutionError\n\t| NoWalletConnectedError\n\t| TransactionError;\n"],"mappings":";;;AAQO,IAAM,YAAN,c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EO,IAAM,qBAAN,cAAiC,iBAAiB;AAAA,EAC/C,OAAO;AAAA,EAChB,YAAY,YAAoB;AAC/B,UAAM,4BAA4B,UAAU,IAAI;AAAA,MAC/C,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AACD;AAWO,IAAM,0BAAN,cAAsC,iBAAiB;AAAA,EACpD,OAAO;AAAA,EAChB,cAAc;AACb,UAAM,6BAA6B;AAAA,MAClC,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AACD;AAEO,IAAM,0BAAN,cAAsC,iBAAiB;AAAA,EACpD,OAAO;AAAA,EAChB,YAAY,MAAc,OAAe;AACxC,UAAM,yCAAyC,IAAI,IAAI;AAAA,MACtD,SACC,OAAO,WACP;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;AAEO,IAAM,+BAAN,cAA2C,iBAAiB;AAAA,EACzD,OAAO;AAAA,EAChB,YAAY,MAAc,OAAe;AACxC,UAAM,wCAAwC,IAAI,IAAI;AAAA,MACrD,SACC,OAAO,WACP;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;AAEO,IAAM,uBAAN,cAAmC,iBAAiB;AAAA,EACjD,OAAO;AAAA,EAChB,YAAY,OAAe;AAC1B,UAAM,kCAAkC;AAAA,MACvC,SACC,OAAO,WACP;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;AAEO,IAAM,mBAAN,cAA+B,iBAAiB;AAAA,EAC7C,OAAO;AAAA,EAChB,YAAY,SAAiB,OAAe;AAC3C,UAAM,yBAAyB,OAAO,IAAI;AAAA,MACzC,SACC,OAAO,WACP;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import {
|
|
3
3
|
MissingConfigError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-E3ZFT6WR.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/address.ts
|
|
7
7
|
var truncateMiddle = (address, minPrefix = 20, minSuffix = 3) => {
|
|
@@ -84,4 +84,4 @@ export {
|
|
|
84
84
|
getPresentableChainName,
|
|
85
85
|
calculatePriceDifferencePercentage
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=chunk-
|
|
87
|
+
//# sourceMappingURL=chunk-KRMV6FJE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/_internal/error/base.ts","../src/utils/_internal/error/transaction.ts"],"sourcesContent":["export type ErrorType<name extends string = 'Error'> = Error & { name: name };\n\nexport type Compute<type> = { [key in keyof type]: type[key] } & unknown;\n\ntype BaseErrorOptions = Compute<\n\t{ details?: string | undefined } | { cause: BaseError | Error }\n>;\n\nexport class BaseError extends Error {\n\tdetails: string;\n\tshortMessage: string;\n\n\tname = 'MarketplaceSdkBaseError';\n\n\tconstructor(shortMessage: string, options: BaseErrorOptions = {}) {\n\t\tsuper();\n\n\t\tconst details = 'details' in options ? options.details : '';\n\t\tthis.message = [\n\t\t\tshortMessage || 'An error occurred.',\n\t\t\t'',\n\t\t\t...(details ? [`Details: ${details}`] : []),\n\t\t].join('\\n');\n\n\t\tif ('cause' in options && options.cause) {\n\t\t\tthis.cause = options.cause;\n\t\t}\n\n\t\tthis.details = details || '';\n\t\tthis.shortMessage = shortMessage;\n\t}\n}\n","import { Address } from 'viem';\nimport { BaseError } from './base';\n\nexport type TransactionErrorType<name extends string = 'TransactionError'> =\n\tBaseError & { name: name };\n\nexport class TransactionError extends BaseError {\n\toverride name = 'TransactionError';\n}\n\nexport class ChainSwitchError extends TransactionError {\n\toverride name = 'ChainSwitchError';\n\tconstructor(currentChainId: number, targetChainId: number) {\n\t\tsuper(\n\t\t\t`Failed to switch network from ${currentChainId} to ${targetChainId}`,\n\t\t\t{\n\t\t\t\tdetails:\n\t\t\t\t\t'The user may have rejected the network switch or there might be a network connectivity issue.',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport class TransactionExecutionError extends TransactionError {\n\toverride name = 'TransactionExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction may have been rejected or failed during execution.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class TransactionSignatureError extends TransactionError {\n\toverride name = 'TransactionSignatureError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to sign transaction step: ${stepId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The signature request may have been rejected by the user.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class NoWalletConnectedError extends TransactionError {\n\toverride name = 'NoWalletConnectedError';\n\tconstructor() {\n\t\tsuper('No wallet connected', {\n\t\t\tdetails: 'Please connect your wallet before attempting this transaction.',\n\t\t});\n\t}\n}\n\nexport class NoMarketplaceConfigError extends TransactionError {\n\toverride name = 'NoMarketplaceConfigError';\n\tconstructor() {\n\t\tsuper('Marketplace configuration not found', {\n\t\t\tdetails:\n\t\t\t\t'The marketplace configuration is missing or invalid. This could be due to an initialization error.',\n\t\t});\n\t}\n}\n\nexport class UserRejectedRequestError extends TransactionError {\n\toverride name = 'UserRejectedRequestError';\n\tconstructor() {\n\t\tsuper('User rejected the request', {\n\t\t\tdetails: 'The user cancelled or rejected the transaction request.',\n\t\t});\n\t}\n}\n\nexport class InsufficientFundsError extends TransactionError {\n\toverride name = 'InsufficientFundsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Insufficient funds for transaction', {\n\t\t\tdetails:\n\t\t\t\t'The wallet does not have enough funds to complete this transaction.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepExecutionError extends TransactionError {\n\toverride name = 'StepExecutionError';\n\tconstructor(stepId: string, cause?: Error) {\n\t\tsuper(`Failed to execute step ${stepId})`, {\n\t\t\tdetails: cause?.message || 'The step execution failed unexpectedly.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class StepGenerationError extends TransactionError {\n\toverride name = 'StepGenerationError';\n\tconstructor(transactionType: string, cause?: Error) {\n\t\tsuper(`Failed to generate steps for ${transactionType}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'Could not generate the required transaction steps.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalError extends TransactionError {\n\toverride name = 'PaymentModalError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Payment modal operation failed', {\n\t\t\tdetails:\n\t\t\t\tcause?.message || 'The payment modal operation was unsuccessful.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class InvalidStepError extends TransactionError {\n\toverride name = 'InvalidStepError';\n\tconstructor(stepId: string, reason: string) {\n\t\tsuper(`Invalid step configuration for ${stepId}`, {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class TransactionConfirmationError extends TransactionError {\n\toverride name = 'TransactionConfirmationError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to confirm transaction ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction could not be confirmed on the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrderNotFoundError extends TransactionError {\n\toverride name = 'OrderNotFoundError';\n\tconstructor(orderId: string) {\n\t\tsuper(`Order ${orderId} not found`, {\n\t\t\tdetails: 'The requested order could not be found in the marketplace.',\n\t\t});\n\t}\n}\n\nexport class MissingStepDataError extends TransactionError {\n\toverride name = 'MissingStepDataError';\n\tconstructor() {\n\t\tsuper('Step is missing required data', {\n\t\t\tdetails:\n\t\t\t\t'The transaction step is missing required \"to\" or \"signature\" data.',\n\t\t});\n\t}\n}\n\nexport class MissingSignatureDataError extends TransactionError {\n\toverride name = 'MissingSignatureDataError';\n\tconstructor() {\n\t\tsuper('Step is missing signature data', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required signature data configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidSignatureStepError extends TransactionError {\n\toverride name = 'InvalidSignatureStepError';\n\tconstructor(stepId: string) {\n\t\tsuper(`Invalid signature step type: ${stepId}`, {\n\t\t\tdetails: 'The signature step type is not supported.',\n\t\t});\n\t}\n}\n\nexport class MissingPostStepError extends TransactionError {\n\toverride name = 'MissingPostStepError';\n\tconstructor() {\n\t\tsuper('Missing post step configuration', {\n\t\t\tdetails:\n\t\t\t\t'The signature step is missing required post-step configuration.',\n\t\t});\n\t}\n}\n\nexport class UnexpectedStepsError extends TransactionError {\n\toverride name = 'UnexpectedStepsError';\n\tconstructor() {\n\t\tsuper('Unexpected steps found', {\n\t\t\tdetails: 'The transaction contains more steps than expected.',\n\t\t});\n\t}\n}\n\nexport class NoExecutionStepError extends TransactionError {\n\toverride name = 'NoExecutionStepError';\n\tconstructor() {\n\t\tsuper('No execution step found', {\n\t\t\tdetails: 'The transaction is missing the required execution step.',\n\t\t});\n\t}\n}\n\nexport class NoStepsFoundError extends TransactionError {\n\toverride name = 'NoStepsFoundError';\n\tconstructor() {\n\t\tsuper('No steps found', {\n\t\t\tdetails: 'The transaction contains no steps to execute.',\n\t\t});\n\t}\n}\n\nexport class UnknownTransactionTypeError extends TransactionError {\n\toverride name = 'UnknownTransactionTypeError';\n\tconstructor(type: string) {\n\t\tsuper(`Unknown transaction type: ${type}`, {\n\t\t\tdetails: 'The specified transaction type is not supported.',\n\t\t});\n\t}\n}\n\nexport class InvalidContractTypeError extends TransactionError {\n\toverride name = 'InvalidContractTypeError';\n\tconstructor(contractType: string | undefined) {\n\t\tsuper(`Invalid contract type: ${contractType}`, {\n\t\t\tdetails: 'The contract type must be either ERC721 or ERC1155.',\n\t\t});\n\t}\n}\n\nexport class CollectionNotFoundError extends TransactionError {\n\toverride name = 'CollectionNotFoundError';\n\tconstructor(collectionAddress: string) {\n\t\tsuper(`Collection not found: ${collectionAddress}`, {\n\t\t\tdetails:\n\t\t\t\t'The specified collection address could not be found in the marketplace configuration.',\n\t\t});\n\t}\n}\n\nexport class InvalidCurrencyOptionsError extends TransactionError {\n\toverride name = 'InvalidCurrencyOptionsError';\n\tconstructor(currencyOptions: Address[]) {\n\t\tsuper(`Invalid currency options: ${currencyOptions}`, {\n\t\t\tdetails:\n\t\t\t\t'The currency options must be an array of valid currency contract addresses.',\n\t\t});\n\t}\n}\n\nexport class ProjectNotFoundError extends TransactionError {\n\toverride name = 'ProjectNotFoundError';\n\tconstructor(projectId: string, url: string) {\n\t\tsuper(`Project not found`, {\n\t\t\tdetails: `Project id: ${projectId} not found at ${url}`,\n\t\t});\n\t}\n}\n\nexport class MarketplaceConfigFetchError extends TransactionError {\n\toverride name = 'MarketplaceConfigFetchError';\n\tconstructor(message: string) {\n\t\tsuper('Failed to fetch marketplace config', {\n\t\t\tdetails: message,\n\t\t});\n\t}\n}\n\nexport class MissingConfigError extends TransactionError {\n\toverride name = 'MissingConfigError';\n\tconstructor(configName: string) {\n\t\tsuper(`Missing required config: ${configName}`, {\n\t\t\tdetails: 'A required configuration parameter is missing.',\n\t\t});\n\t}\n}\n\nexport class TransactionValidationError extends TransactionError {\n\toverride name = 'TransactionValidationError';\n\tconstructor(reason: string) {\n\t\tsuper('Transaction validation failed', {\n\t\t\tdetails: reason,\n\t\t});\n\t}\n}\n\nexport class ChainIdUnavailableError extends TransactionError {\n\toverride name = 'ChainIdUnavailableError';\n\tconstructor() {\n\t\tsuper('Chain ID is not available', {\n\t\t\tdetails: 'Could not determine the current chain ID from the wallet.',\n\t\t});\n\t}\n}\n\nexport class TransactionReceiptError extends TransactionError {\n\toverride name = 'TransactionReceiptError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Failed to get transaction receipt for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the transaction receipt from the network.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class PaymentModalTransactionError extends TransactionError {\n\toverride name = 'PaymentModalTransactionError';\n\tconstructor(hash: string, cause?: Error) {\n\t\tsuper(`Payment modal transaction failed for ${hash}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'The transaction initiated from the payment modal failed.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class CheckoutOptionsError extends TransactionError {\n\toverride name = 'CheckoutOptionsError';\n\tconstructor(cause?: Error) {\n\t\tsuper('Failed to get checkout options', {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the checkout options from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport class OrdersFetchError extends TransactionError {\n\toverride name = 'OrdersFetchError';\n\tconstructor(orderId: string, cause?: Error) {\n\t\tsuper(`Failed to fetch order ${orderId}`, {\n\t\t\tdetails:\n\t\t\t\tcause?.message ||\n\t\t\t\t'Could not retrieve the order details from the marketplace.',\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport type TransactionErrorTypes =\n\t| ChainIdUnavailableError\n\t| TransactionReceiptError\n\t| PaymentModalTransactionError\n\t| CheckoutOptionsError\n\t| OrdersFetchError\n\t| TransactionConfirmationError\n\t| TransactionValidationError\n\t| MissingConfigError\n\t| MarketplaceConfigFetchError\n\t| ProjectNotFoundError\n\t| CollectionNotFoundError\n\t| InvalidCurrencyOptionsError\n\t| InvalidContractTypeError\n\t| UnknownTransactionTypeError\n\t| NoStepsFoundError\n\t| NoExecutionStepError\n\t| UnexpectedStepsError\n\t| MissingPostStepError\n\t| InvalidSignatureStepError\n\t| MissingSignatureDataError\n\t| MissingStepDataError\n\t| OrderNotFoundError\n\t| TransactionConfirmationError\n\t| InvalidStepError\n\t| PaymentModalError\n\t| StepGenerationError\n\t| StepExecutionError\n\t| UserRejectedRequestError\n\t| NoMarketplaceConfigError\n\t| InsufficientFundsError\n\t| ChainSwitchError\n\t| TransactionSignatureError\n\t| TransactionExecutionError\n\t| NoWalletConnectedError\n\t| TransactionError;\n"],"mappings":";AAQO,IAAM,YAAN,cAAwB,MAAM;AAAA,EACpC;AAAA,EACA;AAAA,EAEA,OAAO;AAAA,EAEP,YAAY,cAAsB,UAA4B,CAAC,GAAG;AACjE,UAAM;AAEN,UAAM,UAAU,aAAa,UAAU,QAAQ,UAAU;AACzD,SAAK,UAAU;AAAA,MACd,gBAAgB;AAAA,MAChB;AAAA,MACA,GAAI,UAAU,CAAC,YAAY,OAAO,EAAE,IAAI,CAAC;AAAA,IAC1C,EAAE,KAAK,IAAI;AAEX,QAAI,WAAW,WAAW,QAAQ,OAAO;AACxC,WAAK,QAAQ,QAAQ;AAAA,IACtB;AAEA,SAAK,UAAU,WAAW;AAC1B,SAAK,eAAe;AAAA,EACrB;AACD;;;ACzBO,IAAM,mBAAN,cAA+B,UAAU;AAAA,EACtC,OAAO;AACjB;AAsQO,IAAM,qBAAN,cAAiC,iBAAiB;AAAA,EAC/C,OAAO;AAAA,EAChB,YAAY,YAAoB;AAC/B,UAAM,4BAA4B,UAAU,IAAI;AAAA,MAC/C,SAAS;AAAA,IACV,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
getPresentableChainName,
|
|
15
15
|
getPublicRpcClient
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import {
|
|
18
|
-
ERC1155_ABI
|
|
19
|
-
} from "./chunk-WFE6OCYF.js";
|
|
16
|
+
} from "./chunk-KRMV6FJE.js";
|
|
20
17
|
import {
|
|
21
18
|
EIP2981_ABI
|
|
22
19
|
} from "./chunk-3OHM45R3.js";
|
|
20
|
+
import {
|
|
21
|
+
ERC1155_ABI
|
|
22
|
+
} from "./chunk-WFE6OCYF.js";
|
|
23
23
|
import {
|
|
24
24
|
AddressSchema,
|
|
25
25
|
ChainIdSchema,
|
|
@@ -57,13 +57,13 @@ import {
|
|
|
57
57
|
getMarketplaceClient,
|
|
58
58
|
getMetadataClient,
|
|
59
59
|
getQueryClient
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-3LOJQCTV.js";
|
|
61
61
|
import {
|
|
62
62
|
BaseError,
|
|
63
63
|
ChainIdUnavailableError,
|
|
64
64
|
ChainSwitchError,
|
|
65
65
|
CheckoutOptionsError,
|
|
66
|
-
|
|
66
|
+
InvalidCurrencyOptionsError,
|
|
67
67
|
InvalidSignatureStepError,
|
|
68
68
|
MarketplaceConfigFetchError,
|
|
69
69
|
MissingPostStepError,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
TransactionReceiptError,
|
|
85
85
|
UnexpectedStepsError,
|
|
86
86
|
UnknownTransactionTypeError
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-E3ZFT6WR.js";
|
|
88
88
|
|
|
89
89
|
// src/react/hooks/useBalanceOfCollectible.tsx
|
|
90
90
|
import { queryOptions, skipToken, useQuery } from "@tanstack/react-query";
|
|
@@ -796,33 +796,34 @@ var useCollection = (args) => {
|
|
|
796
796
|
// src/react/hooks/useCurrencies.tsx
|
|
797
797
|
import { queryOptions as queryOptions5, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
798
798
|
import { z as z6 } from "zod";
|
|
799
|
+
import { toHex, zeroAddress } from "viem";
|
|
799
800
|
var ChainIdCoerce = ChainIdSchema.transform((val) => val.toString());
|
|
800
801
|
var UseCurrenciesArgsSchema = z6.object({
|
|
801
802
|
chainId: ChainIdCoerce,
|
|
802
|
-
|
|
803
|
-
|
|
803
|
+
includeNativeCurrency: z6.boolean().optional().default(true),
|
|
804
|
+
currencyOptions: z6.array(AddressSchema).optional(),
|
|
804
805
|
query: QueryArgSchema
|
|
805
806
|
});
|
|
806
807
|
var fetchCurrencies = async (chainId, config) => {
|
|
807
808
|
const parsedChainId = ChainIdCoerce.parse(chainId);
|
|
808
809
|
const marketplaceClient = getMarketplaceClient(parsedChainId, config);
|
|
809
|
-
return marketplaceClient.listCurrencies().then(
|
|
810
|
+
return marketplaceClient.listCurrencies().then(
|
|
811
|
+
(resp) => resp.currencies.map((currency) => ({
|
|
812
|
+
...currency,
|
|
813
|
+
// TODO: remove this, when we are sure of the schema
|
|
814
|
+
contractAddress: currency.contractAddress || zeroAddress
|
|
815
|
+
}))
|
|
816
|
+
);
|
|
810
817
|
};
|
|
811
818
|
var selectCurrencies = (data, args) => {
|
|
819
|
+
console.debug("[selectCurrencies]: Select Currencies Input:", { data, args });
|
|
812
820
|
const argsParsed = UseCurrenciesArgsSchema.parse(args);
|
|
813
|
-
if (argsParsed.
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
queryKey: configKeys.marketplace
|
|
817
|
-
})[0][1];
|
|
818
|
-
const collection = marketplaceConfigCache?.collections.find(
|
|
819
|
-
(collection2) => collection2.collectionAddress === argsParsed.collectionAddress
|
|
820
|
-
);
|
|
821
|
-
if (!collection) {
|
|
822
|
-
throw new CollectionNotFoundError(argsParsed.collectionAddress);
|
|
821
|
+
if (argsParsed.currencyOptions) {
|
|
822
|
+
if (!argsParsed.currencyOptions) {
|
|
823
|
+
throw new InvalidCurrencyOptionsError(argsParsed.currencyOptions);
|
|
823
824
|
}
|
|
824
825
|
return data.filter(
|
|
825
|
-
(currency) =>
|
|
826
|
+
(currency) => argsParsed.currencyOptions?.includes(toHex(currency.contractAddress)) || // biome-ignore lint/suspicious/noDoubleEquals: <explanation>
|
|
826
827
|
currency.nativeCurrency == argsParsed.includeNativeCurrency || currency.defaultChainCurrency
|
|
827
828
|
);
|
|
828
829
|
}
|
|
@@ -1725,21 +1726,27 @@ var TransactionMachine = class {
|
|
|
1725
1726
|
additionalFees: []
|
|
1726
1727
|
}).then((resp) => resp.steps);
|
|
1727
1728
|
case "LISTING" /* LISTING */:
|
|
1729
|
+
if (!this.config.config.orderbookKind) {
|
|
1730
|
+
this.config.config.orderbookKind = "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
1731
|
+
}
|
|
1728
1732
|
return await this.marketplaceClient.generateListingTransaction({
|
|
1729
1733
|
collectionAddress,
|
|
1730
1734
|
owner: address,
|
|
1731
1735
|
walletType: this.config.config.walletKind,
|
|
1732
1736
|
contractType: props.contractType,
|
|
1733
|
-
orderbook:
|
|
1737
|
+
orderbook: this.config.config.orderbookKind,
|
|
1734
1738
|
listing: props.listing
|
|
1735
1739
|
}).then((resp) => resp.steps);
|
|
1736
1740
|
case "OFFER" /* OFFER */:
|
|
1741
|
+
if (!this.config.config.orderbookKind) {
|
|
1742
|
+
this.config.config.orderbookKind = "sequence_marketplace_v2" /* sequence_marketplace_v2 */;
|
|
1743
|
+
}
|
|
1737
1744
|
return await this.marketplaceClient.generateOfferTransaction({
|
|
1738
1745
|
collectionAddress,
|
|
1739
1746
|
maker: address,
|
|
1740
1747
|
walletType: this.config.config.walletKind,
|
|
1741
1748
|
contractType: props.contractType,
|
|
1742
|
-
orderbook:
|
|
1749
|
+
orderbook: this.config.config.orderbookKind,
|
|
1743
1750
|
offer: props.offer
|
|
1744
1751
|
}).then((resp) => resp.steps);
|
|
1745
1752
|
case "CANCEL" /* CANCEL */:
|
|
@@ -2395,4 +2402,4 @@ export {
|
|
|
2395
2402
|
useCancelOrder,
|
|
2396
2403
|
useBuyCollectable
|
|
2397
2404
|
};
|
|
2398
|
-
//# sourceMappingURL=chunk-
|
|
2405
|
+
//# sourceMappingURL=chunk-OQDNL7UW.js.map
|