@imtbl/sdk 0.16.0-alpha.1 → 0.17.0

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.
@@ -11141,6 +11141,68 @@ type ERC20Gas = {
11141
11141
  contractAddress: string;
11142
11142
  limit: BigNumber;
11143
11143
  };
11144
+ /**
11145
+ * Represents the result of {@link Checkout.smartCheckout}.
11146
+ * @property {boolean} sufficient - If the user address has sufficient funds to cover the transaction.
11147
+ * @property {TransactionRequirement[]} transactionRequirements - The transaction requirements.
11148
+ */
11149
+ interface SmartCheckoutResult {
11150
+ sufficient: boolean;
11151
+ transactionRequirements: TransactionRequirement[];
11152
+ }
11153
+ /**
11154
+ * Represents the transaction requirement for a transaction.
11155
+ * @property {ItemType} type - The type of the transaction requirement.
11156
+ * @property {boolean} sufficient - If the user address has sufficient funds to cover the transaction.
11157
+ * @property {TransactionRequirementItem} required - The required item balance.
11158
+ * @property {TransactionRequirementItem} current - The current item balance.
11159
+ * @property {TransactionRequirementDelta} delta - The delta between the required and current balances.
11160
+ */
11161
+ type TransactionRequirement = {
11162
+ type: ItemType;
11163
+ sufficient: boolean;
11164
+ required: ItemBalance;
11165
+ current: ItemBalance;
11166
+ delta: BalanceDelta;
11167
+ };
11168
+ /**
11169
+ * Represents the balance for either a native or ERC20 token.
11170
+ * @property {BigNumber} balance - The balance of the item.
11171
+ * @property {string} formattedBalance - The formatted balance of the item.
11172
+ * @property {TokenInfo} token - The token info of the item.
11173
+ */
11174
+ type TokenBalance = {
11175
+ type: ItemType.NATIVE | ItemType.ERC20;
11176
+ balance: BigNumber;
11177
+ formattedBalance: string;
11178
+ token: TokenInfo;
11179
+ };
11180
+ /**
11181
+ * Represents the balance for an ERC20.
11182
+ * @property {BigNumber} balance - The balance of the item.
11183
+ * @property {string} formattedBalance - The formatted balance of the item.
11184
+ * @property {TokenInfo} token - The token info of the item.
11185
+ */
11186
+ interface ERC721Balance {
11187
+ type: ItemType.ERC721;
11188
+ balance: BigNumber;
11189
+ formattedBalance: string;
11190
+ contractAddress: string;
11191
+ id: string;
11192
+ }
11193
+ /**
11194
+ * Type representing the balance of an item.
11195
+ */
11196
+ type ItemBalance = ERC721Balance | TokenBalance;
11197
+ /**
11198
+ * Represents the delta between two balances.
11199
+ * @property {BigNumber} balance - The delta of the balance.
11200
+ * @property {string} formattedBalance - The formatted balance of the delta.
11201
+ */
11202
+ type BalanceDelta = {
11203
+ balance: BigNumber;
11204
+ formattedBalance: string;
11205
+ };
11144
11206
  /**
11145
11207
  * Interface representing the parameters for {@link Checkout.buy}
11146
11208
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -11150,9 +11212,65 @@ interface BuyParams {
11150
11212
  provider: Web3Provider;
11151
11213
  orderId: string;
11152
11214
  }
11215
+ /**
11216
+ * Interface representing the result of the buy
11217
+ * @property {SmartCheckoutResult} smartCheckoutResult - The result of smart checkout.
11218
+ * @property {string} orderId - The order ID.
11219
+ * @property {BuyStatus} status - The status of the buy, present when smart checkout balances are sufficient
11220
+ * and the transactions were executed
11221
+ */
11222
+ type BuyResult = {
11223
+ smartCheckoutResult: SmartCheckoutResult;
11224
+ orderId: string;
11225
+ status?: BuyStatus;
11226
+ };
11227
+ /**
11228
+ * Represents the status of the transaction for the Buy
11229
+ */
11230
+ type BuyStatus = BuySuccessStatus | BuyFailedStatus;
11231
+ /**
11232
+ * Represents the status of a successful Buy
11233
+ * @property {string} type - The success buy status type.
11234
+ */
11235
+ interface BuySuccessStatus {
11236
+ type: BuyStatusType.SUCCESS;
11237
+ }
11238
+ /**
11239
+ * Represents the status of a failed Buy
11240
+ * @property {string} type - The failed buy status type.
11241
+ * @property {string} transactionHash - The transaction hash of the failed transaction.
11242
+ * @property {string} reason - The reason for the failed transaction.
11243
+ */
11244
+ interface BuyFailedStatus {
11245
+ type: BuyStatusType.FAILED;
11246
+ transactionHash: string;
11247
+ reason: string;
11248
+ }
11249
+ /**
11250
+ * A type representing the status of the transaction for the Buy
11251
+ * @enum {string}
11252
+ * @property {string} SUCCESS - All the transactions were successful.
11253
+ * @property {string} FAILED - At least one of the transactions failed.
11254
+ */
11255
+ declare enum BuyStatusType {
11256
+ SUCCESS = "SUCCESS",
11257
+ FAILED = "FAILED"
11258
+ }
11259
+ /**
11260
+ * Interface representing the parameters for {@link Checkout.cancel}
11261
+ * @property {Web3Provider} provider - The provider to use for the cancel.
11262
+ * @property {string} orderId - The order ID.
11263
+ */
11264
+ interface CancelParams {
11265
+ provider: Web3Provider;
11266
+ orderId: string;
11267
+ }
11153
11268
  interface CheckoutOverrides {
11154
11269
  }
11155
11270
  interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11271
+ isOnRampEnabled?: boolean;
11272
+ isSwapEnabled?: boolean;
11273
+ isBridgeEnabled?: boolean;
11156
11274
  }
11157
11275
  /**
11158
11276
  * A type representing various remotely defined configurations which are
@@ -11387,6 +11505,91 @@ declare enum NetworkFilterTypes {
11387
11505
  interface NetworkFilter {
11388
11506
  chainId: ChainId;
11389
11507
  }
11508
+ /**
11509
+ * Interface representing the parameters for {@link Checkout.sell}
11510
+ * @property {Web3Provider} provider - The provider to use for the sell.
11511
+ * @property {string} id - The ERC721 ID.
11512
+ * @property {string} collectionAddress - The contract address of the ERC721s collection.
11513
+ * @property {BuyToken} buyToken - The token to buy the item with.
11514
+ */
11515
+ interface SellParams {
11516
+ provider: Web3Provider;
11517
+ id: string;
11518
+ collectionAddress: string;
11519
+ buyToken: BuyToken;
11520
+ }
11521
+ /**
11522
+ * Interface representing the result of the sell
11523
+ * @property {string} id - The ERC721 ID.
11524
+ * @property {string} collectionAddress - The contract address of the ERC721s collection.
11525
+ * @property {SmartCheckoutResult} smartCheckoutResult - The result of the smart checkout.
11526
+ * @property {SellStatus} status - The status of the sell, present when smart checkout balances are sufficient
11527
+ */
11528
+ type SellResult = {
11529
+ id: string;
11530
+ collectionAddress: string;
11531
+ smartCheckoutResult: SmartCheckoutResult;
11532
+ status?: SellStatus;
11533
+ };
11534
+ /**
11535
+ * Represents the status of the transaction for the Sell
11536
+ */
11537
+ type SellStatus = SellSuccessStatus | SellFailedStatus;
11538
+ /**
11539
+ * Represents the status of a successful Sell
11540
+ * @property {string} type - The success sell status type.
11541
+ * @property {string} orderId - The order ID of the listing.
11542
+ */
11543
+ interface SellSuccessStatus {
11544
+ type: SellStatusType.SUCCESS;
11545
+ orderId: string;
11546
+ }
11547
+ /**
11548
+ * Represents the status of a failed Sell
11549
+ * @property {string} type - The failed sell status type.
11550
+ * @property {string} transactionHash - The transaction hash of the failed transaction.
11551
+ * @property {string} reason - The reason for the failed transaction.
11552
+ */
11553
+ interface SellFailedStatus {
11554
+ type: SellStatusType.FAILED;
11555
+ transactionHash: string;
11556
+ reason: string;
11557
+ }
11558
+ /**
11559
+ * A type representing the status of the transaction for the Sell
11560
+ * @enum {string}
11561
+ * @property {string} SUCCESS - All the transactions were successful.
11562
+ * @property {string} FAILED - At least one of the transactions failed.
11563
+ */
11564
+ declare enum SellStatusType {
11565
+ SUCCESS = "SUCCESS",
11566
+ FAILED = "FAILED"
11567
+ }
11568
+ /**
11569
+ * Represents the token that the item can be bought with once listed for sale.
11570
+ * NativeBuyToken or ERC20BuyToken {@link Checkout.smartCheckout}.
11571
+ */
11572
+ type BuyToken = NativeBuyToken | ERC20BuyToken;
11573
+ /**
11574
+ * Represents a native buy token
11575
+ * @property {ItemType} type - The type indicate this is a native token.
11576
+ * @property {BigNumber} amount - The amount of native token.
11577
+ */
11578
+ type NativeBuyToken = {
11579
+ type: ItemType.NATIVE;
11580
+ amount: BigNumber;
11581
+ };
11582
+ /**
11583
+ * Represents a ERC20 buy token
11584
+ * @property {ItemType} type - The type indicate this is a ERC20 token.
11585
+ * @property {BigNumber} amount - The amount of native token.
11586
+ * @property {string} contractAddress - The contract address of the ERC20.
11587
+ */
11588
+ type ERC20BuyToken = {
11589
+ type: ItemType.ERC20;
11590
+ amount: BigNumber;
11591
+ contractAddress: string;
11592
+ };
11390
11593
  /**
11391
11594
  * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
11392
11595
  * @property {TokenFilterTypes} type - The type of token to retrieve.
@@ -11549,10 +11752,15 @@ declare enum CheckoutErrorType {
11549
11752
  UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
11550
11753
  UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
11551
11754
  GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
11755
+ CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
11552
11756
  PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
11757
+ CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
11553
11758
  SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
11554
11759
  GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
11555
- GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR"
11760
+ GET_ERC721_ALLOWANCE_ERROR = "GET_ERC721_ALLOWANCE_ERROR",
11761
+ EXECUTE_APPROVAL_TRANSACTION_ERROR = "EXECUTE_APPROVAL_TRANSACTION_ERROR",
11762
+ EXECUTE_FULFILMENT_TRANSACTION_ERROR = "EXECUTE_FULFILMENT_TRANSACTION_ERROR",
11763
+ SIGN_MESSAGE_ERROR = "SIGN_MESSAGE_ERROR"
11556
11764
  }
11557
11765
  /**
11558
11766
  * Represents an error object with a specific type, optional message, and optional data.
@@ -11579,49 +11787,14 @@ declare class RemoteConfigFetcher {
11579
11787
  declare class CheckoutConfiguration {
11580
11788
  readonly isDevelopment: boolean;
11581
11789
  readonly isProduction: boolean;
11790
+ readonly isOnRampEnabled: boolean;
11791
+ readonly isSwapEnabled: boolean;
11792
+ readonly isBridgeEnabled: boolean;
11582
11793
  readonly remote: RemoteConfigFetcher;
11583
11794
  readonly environment: Environment;
11584
11795
  readonly networkMap: NetworkMap;
11585
11796
  constructor(config: CheckoutModuleConfiguration);
11586
11797
  }
11587
- /**
11588
- * Interface representing the parameters for {@link Checkout.sell}
11589
- * @property {Web3Provider} provider - The provider to use for the sell.
11590
- * @property {string} id - The ERC721 ID.
11591
- * @property {string} collectionAddress - The contract address of the ERC721s collection.
11592
- * @property {BuyToken} buyToken - The token to buy the item with.
11593
- */
11594
- interface SellParams {
11595
- provider: Web3Provider;
11596
- id: string;
11597
- collectionAddress: string;
11598
- buyToken: BuyToken;
11599
- }
11600
- /**
11601
- * Represents the token that the item can be bought with once listed for sale.
11602
- * NativeBuyToken or ERC20BuyToken {@link Checkout.smartCheckout}.
11603
- */
11604
- type BuyToken = NativeBuyToken | ERC20BuyToken;
11605
- /**
11606
- * Represents a native buy token
11607
- * @property {ItemType} type - The type indicate this is a native token.
11608
- * @property {BigNumber} amount - The amount of native token.
11609
- */
11610
- type NativeBuyToken = {
11611
- type: ItemType.NATIVE;
11612
- amount: BigNumber;
11613
- };
11614
- /**
11615
- * Represents a ERC20 buy token
11616
- * @property {ItemType} type - The type indicate this is a ERC20 token.
11617
- * @property {BigNumber} amount - The amount of native token.
11618
- * @property {string} contractAddress - The contract address of the ERC20.
11619
- */
11620
- type ERC20BuyToken = {
11621
- type: ItemType.ERC20;
11622
- amount: BigNumber;
11623
- contractAddress: string;
11624
- };
11625
11798
  declare class Checkout {
11626
11799
  readonly config: CheckoutConfiguration;
11627
11800
  /**
@@ -11706,6 +11879,11 @@ declare class Checkout {
11706
11879
  * @param {SellParams} params - The parameters for the sell.
11707
11880
  */
11708
11881
  sell(params: SellParams): Promise<void>;
11882
+ /**
11883
+ * Cancels a sell.
11884
+ * @param {CancelParams} params - The parameters for the cancel.
11885
+ */
11886
+ cancel(params: CancelParams): Promise<void>;
11709
11887
  /**
11710
11888
  * Determines the transaction requirements to complete a purchase.
11711
11889
  * @params {SmartCheckoutParams} params - The parameters for smart checkout.
@@ -11725,4 +11903,4 @@ declare class Checkout {
11725
11903
  gasEstimate(params: GasEstimateParams): Promise<GasEstimateSwapResult | GasEstimateBridgeToL2Result>;
11726
11904
  }
11727
11905
 
11728
- export { AllowedNetworkConfig, BuyParams, CHECKOUT_API_BASE_URL, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, DexConfig, ErrorType, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemType, NetworkFilter, NetworkFilterTypes, NetworkInfo, RemoteConfiguration, SendTransactionParams, SendTransactionResult, SmartCheckoutParams, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
11906
+ export { AllowedNetworkConfig, BuyParams, BuyResult, CHECKOUT_API_BASE_URL, CancelParams, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, DexConfig, ErrorType, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemType, NetworkFilter, NetworkFilterTypes, NetworkInfo, RemoteConfiguration, SellParams, SellResult, SendTransactionParams, SendTransactionResult, SmartCheckoutParams, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };