@imtbl/sdk 0.16.0 → 0.17.1

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.
@@ -10925,6 +10925,7 @@ declare class Passport {
10925
10925
  getUserInfoDeviceFlow(): Promise<UserProfile | undefined>;
10926
10926
  getIdToken(): Promise<string | undefined>;
10927
10927
  getAccessToken(): Promise<string | undefined>;
10928
+ getLinkedAddresses(): Promise<string[]>;
10928
10929
  }
10929
10930
 
10930
10931
  /**
@@ -11140,6 +11141,68 @@ type ERC20Gas = {
11140
11141
  contractAddress: string;
11141
11142
  limit: BigNumber;
11142
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
+ };
11143
11206
  /**
11144
11207
  * Interface representing the parameters for {@link Checkout.buy}
11145
11208
  * @property {Web3Provider} provider - The provider to use for the buy.
@@ -11149,9 +11212,65 @@ interface BuyParams {
11149
11212
  provider: Web3Provider;
11150
11213
  orderId: string;
11151
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
+ }
11152
11268
  interface CheckoutOverrides {
11153
11269
  }
11154
11270
  interface CheckoutModuleConfiguration extends ModuleConfiguration<CheckoutOverrides> {
11271
+ isOnRampEnabled?: boolean;
11272
+ isSwapEnabled?: boolean;
11273
+ isBridgeEnabled?: boolean;
11155
11274
  }
11156
11275
  /**
11157
11276
  * A type representing various remotely defined configurations which are
@@ -11213,6 +11332,15 @@ type GasEstimateSwapTokenConfig = {
11213
11332
  inAddress: string;
11214
11333
  outAddress: string;
11215
11334
  };
11335
+ /**
11336
+ * A type representing all the feature flags available.
11337
+ * @property {TokenInfo[] | undefined} allowed - List of allowed tokens for a given chain.
11338
+ * @property {boolean | undefined} blockscout - Feature flag to enable/disable blockscout integration.
11339
+ */
11340
+ type ChainTokensConfig = {
11341
+ allowed?: TokenInfo[];
11342
+ blockscout?: boolean;
11343
+ };
11216
11344
  /**
11217
11345
  * Represents information about a network.
11218
11346
  * @interface NetworkInfo
@@ -11377,6 +11505,91 @@ declare enum NetworkFilterTypes {
11377
11505
  interface NetworkFilter {
11378
11506
  chainId: ChainId;
11379
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
+ };
11380
11593
  /**
11381
11594
  * Interface representing the parameters for {@link Checkout.getTokenAllowList}.
11382
11595
  * @property {TokenFilterTypes} type - The type of token to retrieve.
@@ -11523,6 +11736,7 @@ declare enum CheckoutErrorType {
11523
11736
  DEFAULT_PROVIDER_ERROR = "DEFAULT_PROVIDER_ERROR",
11524
11737
  CONNECT_PROVIDER_ERROR = "CONNECT_PROVIDER_ERROR",
11525
11738
  GET_BALANCE_ERROR = "GET_BALANCE_ERROR",
11739
+ GET_INDEXER_BALANCE_ERROR = "GET_INDEXER_BALANCE_ERROR",
11526
11740
  GET_ERC20_BALANCE_ERROR = "GET_ERC20_BALANCE_ERROR",
11527
11741
  GET_ERC721_BALANCE_ERROR = "GET_ERC721_BALANCE_ERROR",
11528
11742
  GET_NETWORK_INFO_ERROR = "GET_NETWORK_INFO_ERROR",
@@ -11538,9 +11752,15 @@ declare enum CheckoutErrorType {
11538
11752
  UNSUPPORTED_TOKEN_TYPE_ERROR = "UNSUPPORTED_TOKEN_TYPE_ERROR",
11539
11753
  UNSUPPORTED_BALANCE_REQUIREMENT_ERROR = "UNSUPPORTED_BALANCE_REQUIREMENT_ERROR",
11540
11754
  GET_ORDER_LISTING_ERROR = "GET_ORDER_LISTING_ERROR",
11755
+ CANCEL_ORDER_LISTING_ERROR = "CANCEL_ORDER_LISTING_ERROR",
11756
+ PREPARE_ORDER_LISTING_ERROR = "PREPARE_ORDER_LISTING_ERROR",
11757
+ CREATE_ORDER_LISTING_ERROR = "CREATE_ORDER_LISTING_ERROR",
11541
11758
  SWITCH_NETWORK_UNSUPPORTED = "SWITCH_NETWORK_UNSUPPORTED",
11542
11759
  GET_ERC20_ALLOWANCE_ERROR = "GET_ERC20_ALLOWANCE_ERROR",
11543
- 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"
11544
11764
  }
11545
11765
  /**
11546
11766
  * Represents an error object with a specific type, optional message, and optional data.
@@ -11562,11 +11782,14 @@ type RemoteConfigParams = {
11562
11782
  declare class RemoteConfigFetcher {
11563
11783
  constructor(params: RemoteConfigParams);
11564
11784
  getConfig(key?: keyof RemoteConfiguration): Promise<RemoteConfiguration | RemoteConfiguration[keyof RemoteConfiguration] | undefined>;
11565
- getTokens(chainId: ChainId): Promise<TokenInfo[]>;
11785
+ getTokensConfig(chainId: ChainId): Promise<ChainTokensConfig>;
11566
11786
  }
11567
11787
  declare class CheckoutConfiguration {
11568
11788
  readonly isDevelopment: boolean;
11569
11789
  readonly isProduction: boolean;
11790
+ readonly isOnRampEnabled: boolean;
11791
+ readonly isSwapEnabled: boolean;
11792
+ readonly isBridgeEnabled: boolean;
11570
11793
  readonly remote: RemoteConfigFetcher;
11571
11794
  readonly environment: Environment;
11572
11795
  readonly networkMap: NetworkMap;
@@ -11651,6 +11874,16 @@ declare class Checkout {
11651
11874
  * @param {BuyParams} params - The parameters for the buy.
11652
11875
  */
11653
11876
  buy(params: BuyParams): Promise<void>;
11877
+ /**
11878
+ * Determines the requirements for performing a sell.
11879
+ * @param {SellParams} params - The parameters for the sell.
11880
+ */
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>;
11654
11887
  /**
11655
11888
  * Determines the transaction requirements to complete a purchase.
11656
11889
  * @params {SmartCheckoutParams} params - The parameters for smart checkout.
@@ -11670,4 +11903,4 @@ declare class Checkout {
11670
11903
  gasEstimate(params: GasEstimateParams): Promise<GasEstimateSwapResult | GasEstimateBridgeToL2Result>;
11671
11904
  }
11672
11905
 
11673
- 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 };