@0xsequence/marketplace-sdk 0.3.4 → 0.3.6

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.
Files changed (56) hide show
  1. package/dist/{chunk-PMDJARYX.js → chunk-F42XMKDS.js} +438 -382
  2. package/dist/chunk-F42XMKDS.js.map +1 -0
  3. package/dist/{chunk-Q57TEA3Z.js → chunk-NMCGA2TB.js} +4 -2
  4. package/dist/chunk-NMCGA2TB.js.map +1 -0
  5. package/dist/{chunk-L6GSYPCR.js → chunk-RZSZNVEH.js} +5 -5
  6. package/dist/{chunk-L6GSYPCR.js.map → chunk-RZSZNVEH.js.map} +1 -1
  7. package/dist/{chunk-6LQST3KZ.js → chunk-Z3VR2KMP.js} +30 -18
  8. package/dist/chunk-Z3VR2KMP.js.map +1 -0
  9. package/dist/index.js +72 -172
  10. package/dist/react/hooks/index.d.ts +3 -1
  11. package/dist/react/hooks/index.js +5 -5
  12. package/dist/react/index.js +8 -8
  13. package/dist/react/ui/components/index.js +8 -8
  14. package/dist/react/ui/index.d.ts +4 -21
  15. package/dist/react/ui/index.js +8 -8
  16. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +1 -1
  17. package/dist/react/ui/modals/_internal/components/actionModal/index.js +1 -1
  18. package/dist/react/ui/styles/index.d.ts +1 -1
  19. package/dist/styles/index.d.ts +1 -1
  20. package/dist/styles/index.js +1 -1
  21. package/dist/utils/index.js +1 -1
  22. package/package.json +1 -1
  23. package/src/react/_internal/transaction-machine/execute-transaction.ts +10 -3
  24. package/src/react/_internal/transaction-machine/useTransactionMachine.ts +18 -5
  25. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +1 -1
  26. package/src/react/ui/modals/BuyModal/index.tsx +42 -10
  27. package/src/react/ui/modals/CreateListingModal/index.tsx +9 -16
  28. package/src/react/ui/modals/MakeOfferModal/_store.ts +1 -1
  29. package/src/react/ui/modals/MakeOfferModal/index.tsx +9 -12
  30. package/src/react/ui/modals/SellModal/index.tsx +10 -10
  31. package/src/react/ui/modals/TransferModal/_store.ts +12 -10
  32. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +2 -2
  33. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +16 -38
  34. package/src/react/ui/modals/TransferModal/index.tsx +7 -9
  35. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +4 -2
  36. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +25 -3
  37. package/src/react/ui/modals/_internal/components/switchChainModal/index.tsx +2 -0
  38. package/src/react/ui/modals/_internal/components/switchChainModal/store.ts +4 -4
  39. package/src/react/ui/modals/_internal/components/transaction-footer/index.tsx +7 -4
  40. package/src/react/ui/modals/_internal/components/transactionPreview/consts.ts +10 -5
  41. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +27 -8
  42. package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +3 -5
  43. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +80 -62
  44. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +21 -29
  45. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getFormattedType.ts +23 -0
  46. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getMessage.ts +29 -0
  47. package/src/react/ui/modals/_internal/components/transactionStatusModal/util/getTitle.ts +43 -0
  48. package/tsconfig.tsbuildinfo +1 -1
  49. package/dist/chunk-6LQST3KZ.js.map +0 -1
  50. package/dist/chunk-PMDJARYX.js.map +0 -1
  51. package/dist/chunk-Q57TEA3Z.js.map +0 -1
  52. package/src/react/ui/modals/CreateListingModal/_utils/getCreateListingTransactionTitleMessage.ts +0 -30
  53. package/src/react/ui/modals/MakeOfferModal/_utils/getMakeOfferTransactionTitleMessage.ts +0 -28
  54. package/src/react/ui/modals/SellModal/_utils/getSellTransactionTitleMessage.ts +0 -28
  55. package/src/react/ui/modals/TransferModal/_utils/getTransferTransactionTitleMessage.ts +0 -28
  56. package/src/types/callbacks.ts +0 -51
package/dist/index.js CHANGED
@@ -1,175 +1,75 @@
1
- // ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.5_@vanilla-extract+css@1.16.1/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
2
- function toPrimitive(t, r) {
3
- if ("object" != typeof t || !t) return t;
4
- var e = t[Symbol.toPrimitive];
5
- if (void 0 !== e) {
6
- var i = e.call(t, r || "default");
7
- if ("object" != typeof i) return i;
8
- throw new TypeError("@@toPrimitive must return a primitive value.");
9
- }
10
- return ("string" === r ? String : Number)(t);
11
- }
12
- function toPropertyKey(t) {
13
- var i = toPrimitive(t, "string");
14
- return "symbol" == typeof i ? i : String(i);
15
- }
16
- function _defineProperty(obj, key, value) {
17
- key = toPropertyKey(key);
18
- if (key in obj) {
19
- Object.defineProperty(obj, key, {
20
- value,
21
- enumerable: true,
22
- configurable: true,
23
- writable: true
24
- });
25
- } else {
26
- obj[key] = value;
27
- }
28
- return obj;
29
- }
30
- function ownKeys(e, r) {
31
- var t = Object.keys(e);
32
- if (Object.getOwnPropertySymbols) {
33
- var o = Object.getOwnPropertySymbols(e);
34
- r && (o = o.filter(function(r2) {
35
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
36
- })), t.push.apply(t, o);
37
- }
38
- return t;
39
- }
40
- function _objectSpread2(e) {
41
- for (var r = 1; r < arguments.length; r++) {
42
- var t = null != arguments[r] ? arguments[r] : {};
43
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
44
- _defineProperty(e, r2, t[r2]);
45
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
46
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
47
- });
48
- }
49
- return e;
50
- }
51
- function mapValues(input, fn) {
52
- var result = {};
53
- for (var _key in input) {
54
- result[_key] = fn(input[_key], _key);
55
- }
56
- return result;
57
- }
58
- var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
59
- for (var key of Object.keys(compoundCheck)) {
60
- var _selections$key;
61
- if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
62
- return false;
63
- }
64
- }
65
- return true;
66
- };
67
- var createRuntimeFn = (config) => {
68
- var runtimeFn = (options) => {
69
- var className = config.defaultClassName;
70
- var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
71
- for (var variantName in selections) {
72
- var _selections$variantNa;
73
- var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
74
- if (variantSelection != null) {
75
- var selection = variantSelection;
76
- if (typeof selection === "boolean") {
77
- selection = selection === true ? "true" : "false";
78
- }
79
- var selectionClassName = (
80
- // @ts-expect-error
81
- config.variantClassNames[variantName][selection]
82
- );
83
- if (selectionClassName) {
84
- className += " " + selectionClassName;
85
- }
86
- }
87
- }
88
- for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
89
- if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
90
- className += " " + compoundClassName;
91
- }
92
- }
93
- return className;
94
- };
95
- runtimeFn.variants = () => Object.keys(config.variantClassNames);
96
- runtimeFn.classNames = {
97
- get base() {
98
- return config.defaultClassName.split(" ")[0];
99
- },
100
- get variants() {
101
- return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
102
- }
103
- };
104
- return runtimeFn;
105
- };
106
-
107
- // src/react/ui/icons/styles.css.ts
108
- var iconVariants = createRuntimeFn({ defaultClassName: "styles_iconVariants__1x12tbe0", variantClassNames: { size: { xs: "styles_iconVariants_size_xs__1x12tbe1", sm: "styles_iconVariants_size_sm__1x12tbe2", md: "styles_iconVariants_size_md__1x12tbe3", lg: "styles_iconVariants_size_lg__1x12tbe4", xl: "styles_iconVariants_size_xl__1x12tbe5" } }, defaultVariants: {}, compoundVariants: [] });
109
-
110
- // src/react/ui/modals/_internal/components/actionModal/styles.css.ts
111
- var cta = "styles_cta__1rop7tw0";
112
-
113
- // src/react/ui/modals/_internal/components/calendarPopover/styles.css.ts
114
- var dateSelectButton = "styles_dateSelectButton__1jc6p8j0";
115
- var dateSelectPopoverContent = "fyvr11h8 fyvr11hw fyvr11fw fyvr11gk fyvr11rs fyvr130l fyvr11xx fyvr11r0";
116
-
117
- // src/react/ui/modals/_internal/components/priceInput/styles.css.ts
118
- var priceInputCurrencyImage = "styles_priceInputCurrencyImage__6jjz8t1";
119
- var priceInputWrapper = "styles_priceInputWrapper__6jjz8t0";
120
-
121
- // src/react/ui/modals/_internal/components/quantityInput/styles.css.ts
122
- var quantityInputWrapper = "styles_quantityInputWrapper__50g4m90";
123
-
124
- // src/react/ui/modals/_internal/components/tokenPreview/styles.css.ts
125
- var tokenPreview = "fyvr1188 fyvr11ag fyvr11l8 fyvr11ow fyvr12g";
126
-
127
- // src/react/ui/modals/_internal/components/alertMessage/styles.css.ts
128
- var alertMessageBox = "fyvr11hc fyvr11i0 fyvr11g0 fyvr11go fyvr1vc fyvr1xg fyvr1zk fyvr111o fyvr11l8 fyvr11ow fyvr11o4 fyvr11ck";
129
- var alertMessageBoxVariants = { warning: "styles_alertMessageBoxVariants_warning__yzftal1", info: "styles_alertMessageBoxVariants_info__yzftal2" };
130
-
131
- // src/react/ui/modals/_internal/components/switchChainModal/styles.css.ts
132
- var switchChainCta = { "default": "styles_switchChainCtaBase__xmi06q1", pending: "styles_switchChainCta_pending__xmi06q3 styles_switchChainCtaBase__xmi06q1" };
133
- var switchChainModalContent = "modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120 fyvr11lc fyvr11mc fyvr11cw";
134
-
135
- // src/react/ui/modals/SuccessfulPurchaseModal/styles.css.ts
136
- var collectiblesGrid = "styles_collectiblesGrid__1njkwfe0";
137
- var collectiblesGridImage = "styles_collectiblesGridImage__1njkwfe2";
138
- var collectiblesGridImagePale = "styles_collectiblesGridImagePale__1njkwfe3 styles_collectiblesGridImage__1njkwfe2";
139
- var collectiblesGridItem = "styles_collectiblesGridItem__1njkwfe1";
140
-
141
- // src/react/ui/modals/TransferModal/styles.css.ts
142
- var transferModalContent = "styles_transferModalContent__i1qz9g0 modal_dialogContent_wide__1ypl6nt3 modal_dialogContentBase__1ypl6nt1 fyvr11hg fyvr11i4 fyvr11g4 fyvr11gs fyvr11l8 fyvr11wl fyvr11m0 fyvr11rs fyvr1vo fyvr1xs fyvr1zw fyvr1120";
1
+ "use client"
2
+ import {
3
+ calculatePriceDifferencePercentage,
4
+ compareAddress,
5
+ getPresentableChainName,
6
+ getPublicRpcClient,
7
+ truncateEnd,
8
+ truncateMiddle
9
+ } from "./chunk-OUZ42I6B.js";
10
+ import "./chunk-MJ4YU7RW.js";
11
+ import "./chunk-Q2BVDQ3G.js";
12
+ import {
13
+ CollectibleStatus,
14
+ CollectionStatus,
15
+ ContractType,
16
+ ExecuteType,
17
+ MarketplaceKind,
18
+ OrderSide,
19
+ OrderStatus,
20
+ OrderbookKind,
21
+ ProjectStatus,
22
+ PropertyType,
23
+ SortOrder,
24
+ SourceKind,
25
+ StepType,
26
+ TransactionCrypto,
27
+ WalletKind
28
+ } from "./chunk-D3HRXVYJ.js";
29
+ import "./chunk-3CXEYH2I.js";
30
+ import "./chunk-T2AMWIKD.js";
31
+ import "./chunk-MCI3KOSQ.js";
32
+ import {
33
+ EIP2981_ABI,
34
+ SequenceMarketplaceV1_ABI,
35
+ SequenceMarketplaceV2_ABI
36
+ } from "./chunk-3OHM45R3.js";
37
+ import {
38
+ ERC1155_ABI,
39
+ ERC20_ABI,
40
+ ERC721_ABI
41
+ } from "./chunk-WFE6OCYF.js";
143
42
 
144
- // src/react/ui/components/collectible-card/styles.css.ts
145
- var actionWrapper = "styles_actionWrapper__biep7a7";
146
- var collectibleCard = "styles_collectibleCard__biep7a0";
147
- var collectibleImage = "styles_collectibleImage__biep7a1";
148
- var collectibleTileWrapper = "styles_collectibleTileWrapper__biep7a2";
149
- var footer = { animated: "styles_footer_animated__biep7a5 fyvr11wl", "static": "fyvr11wl" };
150
- var offerBellButton = "styles_offerBellButton__biep7a3";
43
+ // src/consts.ts
44
+ var SEQUENCE_MARKET_V1_ADDRESS = "0xB537a160472183f2150d42EB1c3DD6684A55f74c";
151
45
  export {
152
- actionWrapper,
153
- alertMessageBox,
154
- alertMessageBoxVariants,
155
- collectibleCard,
156
- collectibleImage,
157
- collectibleTileWrapper,
158
- collectiblesGrid,
159
- collectiblesGridImage,
160
- collectiblesGridImagePale,
161
- collectiblesGridItem,
162
- cta,
163
- dateSelectButton,
164
- dateSelectPopoverContent,
165
- footer,
166
- iconVariants,
167
- offerBellButton,
168
- priceInputCurrencyImage,
169
- priceInputWrapper,
170
- quantityInputWrapper,
171
- switchChainCta,
172
- switchChainModalContent,
173
- tokenPreview,
174
- transferModalContent
46
+ CollectibleStatus,
47
+ CollectionStatus,
48
+ ContractType,
49
+ EIP2981_ABI,
50
+ ERC1155_ABI,
51
+ ERC20_ABI,
52
+ ERC721_ABI,
53
+ ExecuteType,
54
+ MarketplaceKind,
55
+ OrderSide,
56
+ OrderStatus,
57
+ OrderbookKind,
58
+ ProjectStatus,
59
+ PropertyType,
60
+ SEQUENCE_MARKET_V1_ADDRESS,
61
+ SequenceMarketplaceV1_ABI,
62
+ SequenceMarketplaceV2_ABI,
63
+ SortOrder,
64
+ SourceKind,
65
+ StepType,
66
+ TransactionCrypto,
67
+ WalletKind,
68
+ calculatePriceDifferencePercentage,
69
+ compareAddress,
70
+ getPresentableChainName,
71
+ getPublicRpcClient,
72
+ truncateEnd,
73
+ truncateMiddle
175
74
  };
75
+ //# sourceMappingURL=index.js.map
@@ -2192,6 +2192,7 @@ declare enum TransactionType {
2192
2192
  SELL = "SELL",
2193
2193
  LISTING = "LISTING",
2194
2194
  OFFER = "OFFER",
2195
+ TRANSFER = "TRANSFER",
2195
2196
  CANCEL = "CANCEL"
2196
2197
  }
2197
2198
  interface TransactionConfig {
@@ -2202,6 +2203,7 @@ interface TransactionConfig {
2202
2203
  collectionAddress: string;
2203
2204
  sdkConfig: SdkConfig;
2204
2205
  marketplaceConfig: MarketplaceConfig;
2206
+ isWaaS: boolean;
2205
2207
  }
2206
2208
  interface BuyInput {
2207
2209
  orderId: string;
@@ -2362,7 +2364,7 @@ declare class OrdersFetchError extends TransactionError {
2362
2364
  }
2363
2365
  type TransactionErrorTypes = ChainIdUnavailableError | TransactionReceiptError | PaymentModalTransactionError | CheckoutOptionsError | OrdersFetchError | TransactionConfirmationError | TransactionValidationError | MissingConfigError | MarketplaceConfigFetchError | ProjectNotFoundError | CollectionNotFoundError | InvalidContractTypeError | UnknownTransactionTypeError | NoStepsFoundError | NoExecutionStepError | UnexpectedStepsError | MissingPostStepError | InvalidSignatureStepError | MissingSignatureDataError | MissingStepDataError | OrderNotFoundError | TransactionConfirmationError | InvalidStepError | PaymentModalError | StepGenerationError | StepExecutionError | UserRejectedRequestError | NoMarketplaceConfigError | InsufficientFundsError | ChainSwitchError | TransactionSignatureError | TransactionExecutionError | NoWalletConnectedError | TransactionError;
2364
2366
 
2365
- type UseTransactionMachineConfig = Omit<TransactionConfig, 'sdkConfig' | 'marketplaceConfig' | 'walletKind' | 'chains'>;
2367
+ type UseTransactionMachineConfig = Omit<TransactionConfig, 'sdkConfig' | 'marketplaceConfig' | 'walletKind' | 'chains' | 'isWaaS'>;
2366
2368
 
2367
2369
  interface UseCancelOrderArgs extends Omit<UseTransactionMachineConfig, 'type'> {
2368
2370
  onSuccess?: (hash: string) => void;
@@ -58,20 +58,20 @@ import {
58
58
  useMarketplaceConfig,
59
59
  useRoyaltyPercentage,
60
60
  useTransferTokens
61
- } from "../../chunk-6LQST3KZ.js";
61
+ } from "../../chunk-Z3VR2KMP.js";
62
62
  import "../../chunk-Y7YO5TLE.js";
63
63
  import "../../chunk-7NJETFMF.js";
64
64
  import "../../chunk-SBVLWSRZ.js";
65
65
  import "../../chunk-NJ2GXOPW.js";
66
- import "../../chunk-MJ4YU7RW.js";
67
66
  import "../../chunk-OUZ42I6B.js";
68
- import "../../chunk-MCI3KOSQ.js";
69
- import "../../chunk-3OHM45R3.js";
70
- import "../../chunk-WFE6OCYF.js";
67
+ import "../../chunk-MJ4YU7RW.js";
71
68
  import "../../chunk-Q2BVDQ3G.js";
72
69
  import "../../chunk-D3HRXVYJ.js";
73
70
  import "../../chunk-3CXEYH2I.js";
74
71
  import "../../chunk-T2AMWIKD.js";
72
+ import "../../chunk-MCI3KOSQ.js";
73
+ import "../../chunk-3OHM45R3.js";
74
+ import "../../chunk-WFE6OCYF.js";
75
75
  export {
76
76
  UseGenerateBuyTransactionArgsSchema,
77
77
  balanceOfCollectibleOptions,
@@ -8,10 +8,10 @@ import {
8
8
  useSellModal,
9
9
  useSuccessfulPurchaseModal,
10
10
  useTransferModal
11
- } from "../chunk-PMDJARYX.js";
12
- import "../chunk-Q57TEA3Z.js";
11
+ } from "../chunk-F42XMKDS.js";
12
+ import "../chunk-NMCGA2TB.js";
13
13
  import "../chunk-FFCNYF3S.js";
14
- import "../chunk-L6GSYPCR.js";
14
+ import "../chunk-RZSZNVEH.js";
15
15
  import "../chunk-O642NH7U.js";
16
16
  import {
17
17
  MarketplaceProvider,
@@ -74,16 +74,13 @@ import {
74
74
  useMarketplaceConfig,
75
75
  useRoyaltyPercentage,
76
76
  useTransferTokens
77
- } from "../chunk-6LQST3KZ.js";
77
+ } from "../chunk-Z3VR2KMP.js";
78
78
  import "../chunk-Y7YO5TLE.js";
79
79
  import "../chunk-7NJETFMF.js";
80
80
  import "../chunk-SBVLWSRZ.js";
81
81
  import "../chunk-NJ2GXOPW.js";
82
- import "../chunk-MJ4YU7RW.js";
83
82
  import "../chunk-OUZ42I6B.js";
84
- import "../chunk-MCI3KOSQ.js";
85
- import "../chunk-3OHM45R3.js";
86
- import "../chunk-WFE6OCYF.js";
83
+ import "../chunk-MJ4YU7RW.js";
87
84
  import "../chunk-Q2BVDQ3G.js";
88
85
  import {
89
86
  getQueryClient
@@ -92,6 +89,9 @@ import {
92
89
  createWagmiConfig
93
90
  } from "../chunk-3CXEYH2I.js";
94
91
  import "../chunk-T2AMWIKD.js";
92
+ import "../chunk-MCI3KOSQ.js";
93
+ import "../chunk-3OHM45R3.js";
94
+ import "../chunk-WFE6OCYF.js";
95
95
  export {
96
96
  CollectibleCard,
97
97
  MarketplaceProvider,
@@ -1,25 +1,25 @@
1
1
  "use client"
2
2
  import {
3
3
  CollectibleCard
4
- } from "../../../chunk-PMDJARYX.js";
5
- import "../../../chunk-Q57TEA3Z.js";
4
+ } from "../../../chunk-F42XMKDS.js";
5
+ import "../../../chunk-NMCGA2TB.js";
6
6
  import "../../../chunk-FFCNYF3S.js";
7
- import "../../../chunk-L6GSYPCR.js";
7
+ import "../../../chunk-RZSZNVEH.js";
8
8
  import "../../../chunk-O642NH7U.js";
9
- import "../../../chunk-6LQST3KZ.js";
9
+ import "../../../chunk-Z3VR2KMP.js";
10
10
  import "../../../chunk-Y7YO5TLE.js";
11
11
  import "../../../chunk-7NJETFMF.js";
12
12
  import "../../../chunk-SBVLWSRZ.js";
13
13
  import "../../../chunk-NJ2GXOPW.js";
14
- import "../../../chunk-MJ4YU7RW.js";
15
14
  import "../../../chunk-OUZ42I6B.js";
16
- import "../../../chunk-MCI3KOSQ.js";
17
- import "../../../chunk-3OHM45R3.js";
18
- import "../../../chunk-WFE6OCYF.js";
15
+ import "../../../chunk-MJ4YU7RW.js";
19
16
  import "../../../chunk-Q2BVDQ3G.js";
20
17
  import "../../../chunk-D3HRXVYJ.js";
21
18
  import "../../../chunk-3CXEYH2I.js";
22
19
  import "../../../chunk-T2AMWIKD.js";
20
+ import "../../../chunk-MCI3KOSQ.js";
21
+ import "../../../chunk-3OHM45R3.js";
22
+ import "../../../chunk-WFE6OCYF.js";
23
23
  export {
24
24
  CollectibleCard
25
25
  };
@@ -10,24 +10,6 @@ import 'zod';
10
10
 
11
11
  declare const ModalProvider: () => react_jsx_runtime.JSX.Element;
12
12
 
13
- type OnApproveTokenError = (error: Error | unknown) => void;
14
- type BaseErrorCallbacks = {
15
- onApproveTokenError?: OnApproveTokenError;
16
- onSwitchingNotSupportedError?: () => void;
17
- onUserRejectedSwitchingChainRequestError?: () => void;
18
- onSwitchChainError?: (error: Error | unknown) => void;
19
- };
20
- type BaseSuccessCallbacks = {
21
- onApproveTokenSuccess?: () => void;
22
- onSwitchChainSuccess?: () => void;
23
- };
24
- type TransferErrorCallbacks = BaseErrorCallbacks & {
25
- onTransferError?: (error: Error | unknown) => void;
26
- };
27
- type TransferSuccessCallbacks = BaseSuccessCallbacks & {
28
- onTransferSuccess?: () => void;
29
- };
30
-
31
13
  type ModalCallbacks = {
32
14
  onSuccess?: (hash: Hash) => void;
33
15
  onError?: (error: Error) => void;
@@ -83,14 +65,15 @@ declare const useSuccessfulPurchaseModal: (callbacks?: ModalCallbacks) => {
83
65
 
84
66
  type ShowTransferModalArgs = {
85
67
  collectionAddress: Hex;
86
- tokenId: string;
68
+ collectibleId: string;
87
69
  chainId: string;
70
+ callbacks?: ModalCallbacks;
88
71
  };
89
72
  declare const useTransferModal: () => {
90
73
  show: (args: ShowTransferModalArgs) => void;
91
74
  close: () => void;
92
- onError: (callbacks: TransferErrorCallbacks) => void;
93
- onSuccess: (callbacks: TransferSuccessCallbacks) => void;
75
+ onError: (callbacks: ModalCallbacks) => void;
76
+ onSuccess: (callbacks: ModalCallbacks) => void;
94
77
  };
95
78
 
96
79
  type ShowSellModalArgs = {
@@ -8,25 +8,25 @@ import {
8
8
  useSellModal,
9
9
  useSuccessfulPurchaseModal,
10
10
  useTransferModal
11
- } from "../../chunk-PMDJARYX.js";
12
- import "../../chunk-Q57TEA3Z.js";
11
+ } from "../../chunk-F42XMKDS.js";
12
+ import "../../chunk-NMCGA2TB.js";
13
13
  import "../../chunk-FFCNYF3S.js";
14
- import "../../chunk-L6GSYPCR.js";
14
+ import "../../chunk-RZSZNVEH.js";
15
15
  import "../../chunk-O642NH7U.js";
16
- import "../../chunk-6LQST3KZ.js";
16
+ import "../../chunk-Z3VR2KMP.js";
17
17
  import "../../chunk-Y7YO5TLE.js";
18
18
  import "../../chunk-7NJETFMF.js";
19
19
  import "../../chunk-SBVLWSRZ.js";
20
20
  import "../../chunk-NJ2GXOPW.js";
21
- import "../../chunk-MJ4YU7RW.js";
22
21
  import "../../chunk-OUZ42I6B.js";
23
- import "../../chunk-MCI3KOSQ.js";
24
- import "../../chunk-3OHM45R3.js";
25
- import "../../chunk-WFE6OCYF.js";
22
+ import "../../chunk-MJ4YU7RW.js";
26
23
  import "../../chunk-Q2BVDQ3G.js";
27
24
  import "../../chunk-D3HRXVYJ.js";
28
25
  import "../../chunk-3CXEYH2I.js";
29
26
  import "../../chunk-T2AMWIKD.js";
27
+ import "../../chunk-MCI3KOSQ.js";
28
+ import "../../chunk-3OHM45R3.js";
29
+ import "../../chunk-WFE6OCYF.js";
30
30
  export {
31
31
  CollectibleCard,
32
32
  ModalProvider,
@@ -19,7 +19,7 @@ interface ActionModalProps {
19
19
  children: react__default.ReactNode;
20
20
  ctas: {
21
21
  label: string;
22
- onClick: () => void;
22
+ onClick: (() => Promise<void>) | (() => void);
23
23
  pending?: boolean;
24
24
  disabled?: boolean;
25
25
  hidden?: boolean;
@@ -4,7 +4,7 @@ import {
4
4
  closeModal,
5
5
  createActionModalStore,
6
6
  openModal
7
- } from "../../../../../../chunk-Q57TEA3Z.js";
7
+ } from "../../../../../../chunk-NMCGA2TB.js";
8
8
  import {
9
9
  closeButton,
10
10
  cta,
@@ -1,5 +1,5 @@
1
1
  declare const dialogOverlay: string;
2
- declare const dialogContent: Record<"wide" | "narrow", string>;
2
+ declare const dialogContent: Record<"narrow" | "wide", string>;
3
3
  declare const closeButton: string;
4
4
 
5
5
  export { closeButton, dialogContent, dialogOverlay };
@@ -43,7 +43,7 @@ declare const alertMessageBox: string;
43
43
  declare const alertMessageBoxVariants: Record<"info" | "warning", string>;
44
44
 
45
45
  declare const switchChainModalContent: string;
46
- declare const switchChainCta: Record<"pending" | "default", string>;
46
+ declare const switchChainCta: Record<"default" | "pending", string>;
47
47
 
48
48
  declare const collectiblesGrid: string;
49
49
  declare const collectiblesGridItem: string;
@@ -18,7 +18,7 @@ import {
18
18
  quantityInputWrapper,
19
19
  tokenPreview,
20
20
  transferModalContent
21
- } from "../chunk-L6GSYPCR.js";
21
+ } from "../chunk-RZSZNVEH.js";
22
22
  import {
23
23
  cta
24
24
  } from "../chunk-O642NH7U.js";
@@ -7,6 +7,7 @@ import {
7
7
  truncateEnd,
8
8
  truncateMiddle
9
9
  } from "../chunk-OUZ42I6B.js";
10
+ import "../chunk-T2AMWIKD.js";
10
11
  import "../chunk-MCI3KOSQ.js";
11
12
  import {
12
13
  EIP2981_ABI,
@@ -18,7 +19,6 @@ import {
18
19
  ERC20_ABI,
19
20
  ERC721_ABI
20
21
  } from "../chunk-WFE6OCYF.js";
21
- import "../chunk-T2AMWIKD.js";
22
22
  export {
23
23
  EIP2981_ABI,
24
24
  ERC1155_ABI,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@0xsequence/marketplace-sdk",
3
3
  "private": false,
4
- "version": "0.3.4",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -67,6 +67,7 @@ export enum TransactionType {
67
67
  SELL = 'SELL',
68
68
  LISTING = 'LISTING',
69
69
  OFFER = 'OFFER',
70
+ TRANSFER = 'TRANSFER',
70
71
  CANCEL = 'CANCEL',
71
72
  }
72
73
 
@@ -78,6 +79,7 @@ export interface TransactionConfig {
78
79
  collectionAddress: string;
79
80
  sdkConfig: SdkConfig;
80
81
  marketplaceConfig: MarketplaceConfig;
82
+ isWaaS: boolean;
81
83
  }
82
84
 
83
85
  interface StateConfig {
@@ -360,7 +362,10 @@ export class TransactionMachine {
360
362
 
361
363
  await this.transition(TransactionState.SWITCH_CHAIN);
362
364
  try {
363
- await this.switchChainFn(this.config.config.chainId);
365
+ if (!this.config.config.isWaaS) {
366
+ await this.switchChainFn(this.config.config.chainId);
367
+ }
368
+
364
369
  await this.walletClient.switchChain({
365
370
  id: Number(this.config.config.chainId),
366
371
  });
@@ -413,6 +418,8 @@ export class TransactionMachine {
413
418
 
414
419
  private async executeTransaction(step: Step): Promise<Hash> {
415
420
  try {
421
+ await this.switchChain();
422
+
416
423
  const transactionData = {
417
424
  account: this.getAccount(),
418
425
  chain: this.getChainForTransaction(),
@@ -438,6 +445,8 @@ export class TransactionMachine {
438
445
  throw new MissingPostStepError();
439
446
  }
440
447
 
448
+ await this.switchChain();
449
+
441
450
  let signature: Hex;
442
451
  if (!step.signature) {
443
452
  throw new MissingSignatureDataError();
@@ -594,8 +603,6 @@ export class TransactionMachine {
594
603
  throw new MissingStepDataError();
595
604
  }
596
605
 
597
- await this.switchChain();
598
-
599
606
  if (step.id === StepType.buy) {
600
607
  await this.executeBuyStep({ step, props: props as BuyInput });
601
608
  return;
@@ -18,7 +18,7 @@ import {
18
18
 
19
19
  export type UseTransactionMachineConfig = Omit<
20
20
  TransactionConfig,
21
- 'sdkConfig' | 'marketplaceConfig' | 'walletKind' | 'chains'
21
+ 'sdkConfig' | 'marketplaceConfig' | 'walletKind' | 'chains' | 'isWaaS'
22
22
  >;
23
23
 
24
24
  export const useTransactionMachine = (
@@ -41,7 +41,12 @@ export const useTransactionMachine = (
41
41
 
42
42
  const { connector, isConnected } = useAccount();
43
43
  const walletKind =
44
- connector?.id === 'sequence' ? WalletKind.sequence : WalletKind.unknown;
44
+ connector?.id === 'sequence'
45
+ ? WalletKind.sequence
46
+ : WalletKind.unknown;
47
+
48
+ // TODO: remove this once we have a better way to check if the wallet is a WAAS wallet
49
+ const isWaaS = connector?.id.endsWith('waas') || false;
45
50
 
46
51
  if (!isConnected) {
47
52
  // No wallet connected, TODO: add some sort of state for this
@@ -74,19 +79,27 @@ export const useTransactionMachine = (
74
79
 
75
80
  const machine = new TransactionMachine(
76
81
  {
77
- config: { sdkConfig, marketplaceConfig, walletKind, chains, ...config },
82
+ config: {
83
+ sdkConfig,
84
+ marketplaceConfig,
85
+ walletKind,
86
+ chains,
87
+ ...config,
88
+ isWaaS
89
+ },
78
90
  onSuccess,
79
91
  onTransactionSent,
80
92
  },
81
93
  walletClient,
82
94
  getPublicRpcClient(config.chainId),
83
95
  openSelectPaymentModal,
84
- async (chainId) =>
96
+ async () =>
85
97
  new Promise((resolve, reject) => {
86
98
  showSwitchChainModal({
87
- chainIdToSwitchTo: Number(chainId),
99
+ chainIdToSwitchTo: Number(config.chainId),
88
100
  onSuccess: resolve,
89
101
  onError: reject,
102
+ onClose: reject,
90
103
  });
91
104
  }),
92
105
  );
@@ -121,7 +121,7 @@ export const ActionButton = observer(
121
121
  showTransferModal({
122
122
  collectionAddress: collectionAddress as Hex,
123
123
  chainId: chainId,
124
- tokenId,
124
+ collectibleId: tokenId,
125
125
  })
126
126
  }
127
127
  />