@imtbl/sdk 0.22.1 → 0.22.3
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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.d.ts +409 -171
- package/dist/checkout_sdk.js +265 -177
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +304 -192
- package/dist/index.d.ts +434 -182
- package/dist/index.js +304 -192
- package/dist/passport.js +38 -15
- package/package.json +2 -1
package/dist/checkout_sdk.d.ts
CHANGED
|
@@ -1458,7 +1458,7 @@ interface ApiRegisterPassportUserRequest {
|
|
|
1458
1458
|
* @export
|
|
1459
1459
|
* @interface Fee
|
|
1460
1460
|
*/
|
|
1461
|
-
interface Fee {
|
|
1461
|
+
interface Fee$1 {
|
|
1462
1462
|
/**
|
|
1463
1463
|
* Wallet address
|
|
1464
1464
|
* @type {string}
|
|
@@ -1551,7 +1551,7 @@ interface Asset {
|
|
|
1551
1551
|
* @type {Array<Fee>}
|
|
1552
1552
|
* @memberof Asset
|
|
1553
1553
|
*/
|
|
1554
|
-
'fees'?: Array<Fee>;
|
|
1554
|
+
'fees'?: Array<Fee$1>;
|
|
1555
1555
|
/**
|
|
1556
1556
|
* [DEPRECATED] Internal Immutable X Token ID
|
|
1557
1557
|
* @type {string}
|
|
@@ -1661,7 +1661,7 @@ interface AssetWithOrders {
|
|
|
1661
1661
|
* @type {Array<Fee>}
|
|
1662
1662
|
* @memberof AssetWithOrders
|
|
1663
1663
|
*/
|
|
1664
|
-
'fees'?: Array<Fee>;
|
|
1664
|
+
'fees'?: Array<Fee$1>;
|
|
1665
1665
|
/**
|
|
1666
1666
|
* [DEPRECATED] Internal Immutable X Token ID
|
|
1667
1667
|
* @type {string}
|
|
@@ -5093,7 +5093,7 @@ interface Mint {
|
|
|
5093
5093
|
* @type {Array<Fee>}
|
|
5094
5094
|
* @memberof Mint
|
|
5095
5095
|
*/
|
|
5096
|
-
'fees'?: Array<Fee>;
|
|
5096
|
+
'fees'?: Array<Fee$1>;
|
|
5097
5097
|
/**
|
|
5098
5098
|
* Status of this mint
|
|
5099
5099
|
* @type {string}
|
|
@@ -11016,6 +11016,166 @@ interface GetAllBalancesParams {
|
|
|
11016
11016
|
interface GetAllBalancesResult {
|
|
11017
11017
|
balances: GetBalanceResult[];
|
|
11018
11018
|
}
|
|
11019
|
+
interface OrderFee {
|
|
11020
|
+
amount: FeeToken | FeePercentage;
|
|
11021
|
+
recipient: string;
|
|
11022
|
+
}
|
|
11023
|
+
interface FeeToken {
|
|
11024
|
+
token: string;
|
|
11025
|
+
}
|
|
11026
|
+
interface FeePercentage {
|
|
11027
|
+
percentageDecimal: number;
|
|
11028
|
+
}
|
|
11029
|
+
type BuyResult = BuyResultSuccess | BuyResultFailed | BuyResultInsufficientFunds;
|
|
11030
|
+
/**
|
|
11031
|
+
* Represents the result of {@link Checkout.buy}
|
|
11032
|
+
* @property {CheckoutStatus.SUCCESS} status - The status to indicate success
|
|
11033
|
+
* @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
|
|
11034
|
+
*/
|
|
11035
|
+
type BuyResultSuccess = {
|
|
11036
|
+
status: CheckoutStatus.SUCCESS;
|
|
11037
|
+
smartCheckoutResult: SmartCheckoutSufficient[];
|
|
11038
|
+
};
|
|
11039
|
+
/**
|
|
11040
|
+
* Represents the result of {@link Checkout.buy}
|
|
11041
|
+
* @property {CheckoutStatus.FAILED} status - The status to indicate failure
|
|
11042
|
+
* @property {string} transactionHash - The transaction hash of the failed transaction
|
|
11043
|
+
* @property {string} reason - The reason for the failure
|
|
11044
|
+
* @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
|
|
11045
|
+
*/
|
|
11046
|
+
type BuyResultFailed = {
|
|
11047
|
+
status: CheckoutStatus.FAILED;
|
|
11048
|
+
transactionHash: string;
|
|
11049
|
+
reason: string;
|
|
11050
|
+
smartCheckoutResult: SmartCheckoutSufficient[];
|
|
11051
|
+
};
|
|
11052
|
+
/**
|
|
11053
|
+
* Represents the result of {@link Checkout.buy}
|
|
11054
|
+
* @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
|
|
11055
|
+
* @property {SmartCheckoutInsufficient[]} smartCheckoutResult - The insufficient result of smart checkout
|
|
11056
|
+
*/
|
|
11057
|
+
type BuyResultInsufficientFunds = {
|
|
11058
|
+
status: CheckoutStatus.INSUFFICIENT_FUNDS;
|
|
11059
|
+
smartCheckoutResult: SmartCheckoutInsufficient[];
|
|
11060
|
+
};
|
|
11061
|
+
type SellResult = SellResultSuccess | SellResultFailed | SellResultInsufficientFunds;
|
|
11062
|
+
/**
|
|
11063
|
+
* Represents the result of {@link Checkout.sell}
|
|
11064
|
+
* @property {CheckoutStatus.SUCCESS} status - The status to indicate success
|
|
11065
|
+
* @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
|
|
11066
|
+
*/
|
|
11067
|
+
type SellResultSuccess = {
|
|
11068
|
+
status: CheckoutStatus.SUCCESS;
|
|
11069
|
+
orderIds: string[];
|
|
11070
|
+
smartCheckoutResult: SmartCheckoutSufficient[];
|
|
11071
|
+
};
|
|
11072
|
+
/**
|
|
11073
|
+
* Represents the result of {@link Checkout.sell}
|
|
11074
|
+
* @property {CheckoutStatus.FAILED} status - The status to indicate failure
|
|
11075
|
+
* @property {string} transactionHash - The transaction hash of the failed transaction
|
|
11076
|
+
* @property {string} reason - The reason for the failure
|
|
11077
|
+
* @property {SmartCheckoutSufficient[]} smartCheckoutResult - The sufficient result of smart checkout
|
|
11078
|
+
*/
|
|
11079
|
+
type SellResultFailed = {
|
|
11080
|
+
status: CheckoutStatus.FAILED;
|
|
11081
|
+
transactionHash: string;
|
|
11082
|
+
reason: string;
|
|
11083
|
+
smartCheckoutResult: SmartCheckoutSufficient[];
|
|
11084
|
+
};
|
|
11085
|
+
/**
|
|
11086
|
+
* Represents the result of {@link Checkout.sell}
|
|
11087
|
+
* @property {CheckoutStatus.INSUFFICIENT_FUNDS} status - The status to indicate insufficient funds
|
|
11088
|
+
* @property {SmartCheckoutInsufficient[]} smartCheckoutResult - The insufficient result of smart checkout
|
|
11089
|
+
*/
|
|
11090
|
+
type SellResultInsufficientFunds = {
|
|
11091
|
+
status: CheckoutStatus.INSUFFICIENT_FUNDS;
|
|
11092
|
+
smartCheckoutResult: SmartCheckoutInsufficient[];
|
|
11093
|
+
};
|
|
11094
|
+
type CancelResult = CancelResultSuccess | CancelResultFailed;
|
|
11095
|
+
/**
|
|
11096
|
+
* Represents the result of {@link Checkout.cancel}
|
|
11097
|
+
* @property {CheckoutStatus.SUCCESS} status - The status to indicate success
|
|
11098
|
+
*/
|
|
11099
|
+
type CancelResultSuccess = {
|
|
11100
|
+
status: CheckoutStatus.SUCCESS;
|
|
11101
|
+
};
|
|
11102
|
+
/**
|
|
11103
|
+
* Represents the result of {@link Checkout.cancel}
|
|
11104
|
+
* @property {CheckoutStatus.FAILED} status - The status to indicate failure
|
|
11105
|
+
* @property {string} transactionHash - The transaction hash of the failed transaction
|
|
11106
|
+
* @property {string} reason - The reason for the failure
|
|
11107
|
+
*/
|
|
11108
|
+
type CancelResultFailed = {
|
|
11109
|
+
status: CheckoutStatus.FAILED;
|
|
11110
|
+
transactionHash: string;
|
|
11111
|
+
reason: string;
|
|
11112
|
+
};
|
|
11113
|
+
/**
|
|
11114
|
+
* An enum representing the checkout status types
|
|
11115
|
+
* @enum {string}
|
|
11116
|
+
* @property {string} SUCCESS - If checkout succeeded as the transactions were able to be processed
|
|
11117
|
+
* @property {string} FAILED - If checkout failed due to transactions not settling on chain
|
|
11118
|
+
* @property {string} INSUFFICIENT_FUNDS - If checkout failed due to insufficient funds
|
|
11119
|
+
*/
|
|
11120
|
+
declare enum CheckoutStatus {
|
|
11121
|
+
SUCCESS = "SUCCESS",
|
|
11122
|
+
FAILED = "FAILED",
|
|
11123
|
+
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS"
|
|
11124
|
+
}
|
|
11125
|
+
/**
|
|
11126
|
+
* The type representing the order to buy
|
|
11127
|
+
* @property {string} orderId - the id of the order to buy
|
|
11128
|
+
* @property {Array<OrderFee>} takerFees - array of order fees to apply to the order
|
|
11129
|
+
*/
|
|
11130
|
+
type BuyOrder = {
|
|
11131
|
+
id: string;
|
|
11132
|
+
takerFees?: OrderFee[];
|
|
11133
|
+
};
|
|
11134
|
+
/**
|
|
11135
|
+
* The type representing the sell order to create a listing from
|
|
11136
|
+
* @property {SellToken} sellToken - the token to be listed for sale
|
|
11137
|
+
* @property {BuyToken} buyToken - the token info of the price of the item
|
|
11138
|
+
* @property {OrderFee[]} makerFees - option array of makerFees to be applied to the listing
|
|
11139
|
+
*/
|
|
11140
|
+
type SellOrder = {
|
|
11141
|
+
sellToken: SellToken;
|
|
11142
|
+
buyToken: BuyToken;
|
|
11143
|
+
makerFees?: OrderFee[];
|
|
11144
|
+
};
|
|
11145
|
+
/**
|
|
11146
|
+
* Represents the token that the item can be bought with once listed for sale.
|
|
11147
|
+
* NativeBuyToken or ERC20BuyToken {@link Checkout.smartCheckout}.
|
|
11148
|
+
*/
|
|
11149
|
+
type BuyToken = NativeBuyToken | ERC20BuyToken;
|
|
11150
|
+
/**
|
|
11151
|
+
* Represents a native buy token
|
|
11152
|
+
* @property {ItemType} type - The type indicate this is a native token.
|
|
11153
|
+
* @property {string} amount - The amount of native token.
|
|
11154
|
+
*/
|
|
11155
|
+
type NativeBuyToken = {
|
|
11156
|
+
type: ItemType.NATIVE;
|
|
11157
|
+
amount: string;
|
|
11158
|
+
};
|
|
11159
|
+
/**
|
|
11160
|
+
* Represents a ERC20 buy token
|
|
11161
|
+
* @property {ItemType} type - The type indicate this is a ERC20 token.
|
|
11162
|
+
* @property {string} amount - The amount of native token.
|
|
11163
|
+
* @property {string} contractAddress - The contract address of the ERC20.
|
|
11164
|
+
*/
|
|
11165
|
+
type ERC20BuyToken = {
|
|
11166
|
+
type: ItemType.ERC20;
|
|
11167
|
+
amount: string;
|
|
11168
|
+
contractAddress: string;
|
|
11169
|
+
};
|
|
11170
|
+
/**
|
|
11171
|
+
* Interface of the SellToken
|
|
11172
|
+
* @property {string} id - The ERC721 token id
|
|
11173
|
+
* @property {string} collectionAddress - The ERC721 collection address
|
|
11174
|
+
*/
|
|
11175
|
+
type SellToken = {
|
|
11176
|
+
id: string;
|
|
11177
|
+
collectionAddress: string;
|
|
11178
|
+
};
|
|
11019
11179
|
/**
|
|
11020
11180
|
* Interface representing the parameters for {@link Checkout.smartCheckout}
|
|
11021
11181
|
* @property {Web3Provider} provider - The provider to use for smart checkout.
|
|
@@ -11027,16 +11187,35 @@ interface SmartCheckoutParams {
|
|
|
11027
11187
|
itemRequirements: (NativeItemRequirement | ERC20ItemRequirement | ERC721ItemRequirement)[];
|
|
11028
11188
|
transactionOrGasAmount: FulfillmentTransaction | GasAmount;
|
|
11029
11189
|
}
|
|
11190
|
+
/**
|
|
11191
|
+
* Represents a native item requirement for a transaction.
|
|
11192
|
+
* @property {ItemType.NATIVE} type - The type to indicate this is a native item requirement.
|
|
11193
|
+
* @property {string} amount - The amount of the item.
|
|
11194
|
+
*/
|
|
11030
11195
|
type NativeItemRequirement = {
|
|
11031
11196
|
type: ItemType.NATIVE;
|
|
11032
11197
|
amount: string;
|
|
11033
11198
|
};
|
|
11199
|
+
/**
|
|
11200
|
+
* Represents an ERC20 item requirement for a transaction.
|
|
11201
|
+
* @property {ItemType.ERC20} type - The type to indicate this is a ERC20 item requirement.
|
|
11202
|
+
* @property {string} amount - The amount of the item.
|
|
11203
|
+
* @property {string} contractAddress - The contract address of the ERC20.
|
|
11204
|
+
* @property {string} spenderAddress - The contract address of the approver.
|
|
11205
|
+
*/
|
|
11034
11206
|
type ERC20ItemRequirement = {
|
|
11035
11207
|
type: ItemType.ERC20;
|
|
11036
11208
|
contractAddress: string;
|
|
11037
11209
|
amount: string;
|
|
11038
11210
|
spenderAddress: string;
|
|
11039
11211
|
};
|
|
11212
|
+
/**
|
|
11213
|
+
* Represents an ERC721 item requirement for a transaction.
|
|
11214
|
+
* @property {ItemType.ERC721} type - The type to indicate this is a ERC721 item requirement.
|
|
11215
|
+
* @property {string} contractAddress - The contract address of the ERC721 collection.
|
|
11216
|
+
* @property {string} id - The ID of this ERC721 in the collection.
|
|
11217
|
+
* @property {string} spenderAddress - The contract address of the approver.
|
|
11218
|
+
*/
|
|
11040
11219
|
type ERC721ItemRequirement = {
|
|
11041
11220
|
type: ItemType.ERC721;
|
|
11042
11221
|
contractAddress: string;
|
|
@@ -11085,7 +11264,7 @@ type ERC20Item = {
|
|
|
11085
11264
|
/**
|
|
11086
11265
|
* Represents an ERC721 item.
|
|
11087
11266
|
* @property {ItemType} type - The type to indicate this is an ERC721 item.
|
|
11088
|
-
* @property {string} contractAddress - The contract address of the ERC721.
|
|
11267
|
+
* @property {string} contractAddress - The contract address of the ERC721 collection.
|
|
11089
11268
|
* @property {string} id - The ID of this ERC721 in the collection.
|
|
11090
11269
|
* @property {string} spenderAddress - The contract address of the approver.
|
|
11091
11270
|
*/
|
|
@@ -11158,14 +11337,217 @@ type ERC20Gas = {
|
|
|
11158
11337
|
limit: BigNumber;
|
|
11159
11338
|
};
|
|
11160
11339
|
/**
|
|
11161
|
-
*
|
|
11162
|
-
* @property {boolean} sufficient - If the user address has sufficient funds to cover the transaction.
|
|
11163
|
-
* @property {TransactionRequirement[]} transactionRequirements - The transaction requirements.
|
|
11340
|
+
* The type representing the result of {@link Checkout.smartCheckout}.
|
|
11164
11341
|
*/
|
|
11165
|
-
|
|
11166
|
-
|
|
11342
|
+
type SmartCheckoutResult = SmartCheckoutSufficient | SmartCheckoutInsufficient;
|
|
11343
|
+
/**
|
|
11344
|
+
* Represents the result of {@link Checkout.smartCheckout} when smart checkout is sufficient.
|
|
11345
|
+
* @property {boolean} sufficient - Indicates that smart checkout determined the user had sufficient funds.
|
|
11346
|
+
* @property {TransactionRequirement[]} transactionRequirements - The transaction requirements smart checkout
|
|
11347
|
+
* determined were required for the transaction.
|
|
11348
|
+
*/
|
|
11349
|
+
type SmartCheckoutSufficient = {
|
|
11350
|
+
sufficient: true;
|
|
11167
11351
|
transactionRequirements: TransactionRequirement[];
|
|
11352
|
+
};
|
|
11353
|
+
/**
|
|
11354
|
+
* Represents the result of {@link Checkout.smartCheckout} when smart checkout is insufficient.
|
|
11355
|
+
* @property {boolean} sufficient - Indicates that smart checkout determined the user has insufficient funds
|
|
11356
|
+
* @property {TransactionRequirement[]} transactionRequirements - The transaction requirements smart checkout
|
|
11357
|
+
* determined were required for the transaction.
|
|
11358
|
+
* @property {SmartCheckoutRouter} router - The type containing the funding routes the user can take to fulfill the transaction requirements
|
|
11359
|
+
*/
|
|
11360
|
+
type SmartCheckoutInsufficient = {
|
|
11361
|
+
sufficient: false;
|
|
11362
|
+
transactionRequirements: TransactionRequirement[];
|
|
11363
|
+
router: SmartCheckoutRouter;
|
|
11364
|
+
};
|
|
11365
|
+
/**
|
|
11366
|
+
* Represents the routing outcome for a transaction.
|
|
11367
|
+
* @property {boolean} isPassport - Indicates if the provider used was a passport provider.
|
|
11368
|
+
* @property {AvailableRoutingOptions} availableRoutingOptions - The routing options available to the user
|
|
11369
|
+
* @property {RoutingOutcome} routingOutcome - The routing outcome for the transaction which
|
|
11370
|
+
* includes the funding routes if routes were found
|
|
11371
|
+
*/
|
|
11372
|
+
type SmartCheckoutRouter = {
|
|
11373
|
+
isPassport: boolean;
|
|
11374
|
+
availableRoutingOptions: AvailableRoutingOptions;
|
|
11375
|
+
routingOutcome: RoutingOutcome;
|
|
11376
|
+
};
|
|
11377
|
+
/**
|
|
11378
|
+
* An enum representing the routing outcome types
|
|
11379
|
+
* @enum {string}
|
|
11380
|
+
* @property {string} ROUTES_FOUND - If funding routes were found for the transaction.
|
|
11381
|
+
* @property {string} NO_ROUTES_FOUND - If no funding routes were found for the transaction.
|
|
11382
|
+
* @property {string} NO_ROUTE_OPTIONS - If no routing options were available for the transaction.
|
|
11383
|
+
*/
|
|
11384
|
+
declare enum RoutingOutcomeType {
|
|
11385
|
+
ROUTES_FOUND = "ROUTES_FOUND",
|
|
11386
|
+
NO_ROUTES_FOUND = "NO_ROUTES_FOUND",
|
|
11387
|
+
NO_ROUTE_OPTIONS = "NO_ROUTE_OPTIONS"
|
|
11388
|
+
}
|
|
11389
|
+
type RoutingOutcome = RoutesFound | NoRoutesFound | NoRouteOptions;
|
|
11390
|
+
/**
|
|
11391
|
+
* Represents a routing outcome where funding routes were found.
|
|
11392
|
+
* @property {RoutingOutcomeType.ROUTES_FOUND} type - Indicates that funding routes were found for the transaction.
|
|
11393
|
+
* @property {AvailableRoutingOptions} fundingRoutes - The funding routes found for the transaction.
|
|
11394
|
+
*/
|
|
11395
|
+
type RoutesFound = {
|
|
11396
|
+
type: RoutingOutcomeType.ROUTES_FOUND;
|
|
11397
|
+
fundingRoutes: FundingRoute[];
|
|
11398
|
+
};
|
|
11399
|
+
/**
|
|
11400
|
+
* Represents a routing outcome where no funding routes were found.
|
|
11401
|
+
* @property {RoutingOutcomeType.NO_ROUTES_FOUND} type - Indicates that no funding routes were found for the transaction.
|
|
11402
|
+
* @property {string} message - The message indicating why no funding routes were found.
|
|
11403
|
+
*/
|
|
11404
|
+
type NoRoutesFound = {
|
|
11405
|
+
type: RoutingOutcomeType.NO_ROUTES_FOUND;
|
|
11406
|
+
message: string;
|
|
11407
|
+
};
|
|
11408
|
+
/**
|
|
11409
|
+
* Represents a routing outcome where no routing options were available for the transaction.
|
|
11410
|
+
* @property {RoutingOutcomeType.NO_ROUTE_OPTIONS} type - Indicates that no routing options were available for the transaction.
|
|
11411
|
+
* @property {string} message - The message indicating why no routing options were available.
|
|
11412
|
+
*/
|
|
11413
|
+
type NoRouteOptions = {
|
|
11414
|
+
type: RoutingOutcomeType.NO_ROUTE_OPTIONS;
|
|
11415
|
+
message: string;
|
|
11416
|
+
};
|
|
11417
|
+
/**
|
|
11418
|
+
* Represents a funding route
|
|
11419
|
+
* @property {number} priority - The priority of the route
|
|
11420
|
+
* @property {FundingStep[]} steps - The steps associated with this funding route
|
|
11421
|
+
* @property {TotalFees | undefined} totalFees - The total fees for this route
|
|
11422
|
+
*/
|
|
11423
|
+
type FundingRoute = {
|
|
11424
|
+
priority: number;
|
|
11425
|
+
steps: FundingStep[];
|
|
11426
|
+
totalFees?: TotalFees;
|
|
11427
|
+
};
|
|
11428
|
+
/**
|
|
11429
|
+
* Represents the total fees for a route
|
|
11430
|
+
* @property {Fee} gas - The total gas fees for this funding step
|
|
11431
|
+
* @property {Fee} other - The total of all other fees associated with this funding step
|
|
11432
|
+
* @property {Fee} total - The total combined gas and other fees for this funding step
|
|
11433
|
+
*/
|
|
11434
|
+
type TotalFees = {
|
|
11435
|
+
gas: Fee;
|
|
11436
|
+
other: Fee;
|
|
11437
|
+
total: Fee;
|
|
11438
|
+
};
|
|
11439
|
+
/**
|
|
11440
|
+
* Represents a fee
|
|
11441
|
+
* @property {BigNumber} amount - The amount of the fee
|
|
11442
|
+
* @property {string} formatted - The formatted amount of the fee
|
|
11443
|
+
*/
|
|
11444
|
+
type Fee = {
|
|
11445
|
+
amount: BigNumber;
|
|
11446
|
+
formattedAmount: string;
|
|
11447
|
+
};
|
|
11448
|
+
type FundingStep = BridgeFundingStep | SwapFundingStep | OnRampFundingStep;
|
|
11449
|
+
/**
|
|
11450
|
+
* Represents a bridge funding route
|
|
11451
|
+
* @property {FundingStepType.BRIDGE} type - Indicates that this is a bridge funding step
|
|
11452
|
+
* @property {number} chainId - The chain id the bridge should be executed on
|
|
11453
|
+
* @property {FundingItem} fundingItem - The funding item for the bridge
|
|
11454
|
+
* @property {BridgeFees} fees - The fees for the bridge
|
|
11455
|
+
*/
|
|
11456
|
+
type BridgeFundingStep = {
|
|
11457
|
+
type: FundingStepType.BRIDGE;
|
|
11458
|
+
chainId: number;
|
|
11459
|
+
fundingItem: FundingItem;
|
|
11460
|
+
fees: BridgeFees;
|
|
11461
|
+
};
|
|
11462
|
+
/**
|
|
11463
|
+
* Represents the fees for a bridge funding step
|
|
11464
|
+
* @property {Fee} approvalGasFees - The approval gas fees for the bridge
|
|
11465
|
+
* @property {Fee} bridgeGasFees - The bridge gas fees for the bridge
|
|
11466
|
+
* @property {Fee[]} bridgeFees - Additional bridge fees for the bridge
|
|
11467
|
+
*/
|
|
11468
|
+
type BridgeFees = {
|
|
11469
|
+
approvalGasFees: Fee;
|
|
11470
|
+
bridgeGasFees: Fee;
|
|
11471
|
+
bridgeFees: Fee[];
|
|
11472
|
+
};
|
|
11473
|
+
/**
|
|
11474
|
+
* Represents a swap funding route
|
|
11475
|
+
* @property {FundingStepType.SWAP} type - Indicates that this is a swap funding step
|
|
11476
|
+
* @property {number} chainId - The chain id the swap should be executed on
|
|
11477
|
+
* @property {FundingItem} fundingItem - The funding item for the swap
|
|
11478
|
+
* @property {SwapFees} fees - The fees for the swap
|
|
11479
|
+
*/
|
|
11480
|
+
type SwapFundingStep = {
|
|
11481
|
+
type: FundingStepType.SWAP;
|
|
11482
|
+
chainId: number;
|
|
11483
|
+
fundingItem: FundingItem;
|
|
11484
|
+
fees: SwapFees;
|
|
11485
|
+
};
|
|
11486
|
+
/**
|
|
11487
|
+
* Represents the fees for a swap funding step
|
|
11488
|
+
* @property {Fee} approvalGasFees - The approval gas fees for the swap
|
|
11489
|
+
* @property {Fee} swapGasFees - The swap gas fees for the swap
|
|
11490
|
+
* @property {Fee[]} swapFees - Additional swap fees for the swap
|
|
11491
|
+
*/
|
|
11492
|
+
type SwapFees = {
|
|
11493
|
+
approvalGasFees: Fee;
|
|
11494
|
+
swapGasFees: Fee;
|
|
11495
|
+
swapFees: Fee[];
|
|
11496
|
+
};
|
|
11497
|
+
/**
|
|
11498
|
+
* Represents an onramp funding route
|
|
11499
|
+
* @property {FundingStepType.ONRAMP} type - Indicates that this is an onramp funding step
|
|
11500
|
+
* @property {number} chainId - The chain id the onramp should provide funds to
|
|
11501
|
+
* @property {FundingItem} fundingItem - The item to be onramped
|
|
11502
|
+
*/
|
|
11503
|
+
type OnRampFundingStep = {
|
|
11504
|
+
type: FundingStepType.ONRAMP;
|
|
11505
|
+
chainId: number;
|
|
11506
|
+
fundingItem: FundingItem;
|
|
11507
|
+
};
|
|
11508
|
+
/**
|
|
11509
|
+
* An enum representing the funding step types
|
|
11510
|
+
* @enum {string}
|
|
11511
|
+
* @property {string} BRIDGE - If the funding step is a bridge.
|
|
11512
|
+
* @property {string} SWAP - If the funding step is a swap.
|
|
11513
|
+
* @property {string} ONRAMP - If the funding step is an onramp.
|
|
11514
|
+
*/
|
|
11515
|
+
declare enum FundingStepType {
|
|
11516
|
+
BRIDGE = "BRIDGE",
|
|
11517
|
+
SWAP = "SWAP",
|
|
11518
|
+
ONRAMP = "ONRAMP"
|
|
11168
11519
|
}
|
|
11520
|
+
/**
|
|
11521
|
+
* Represents a funding item
|
|
11522
|
+
* @property {ItemType.NATIVE | ItemType.ERC20} type - The type of the funding item
|
|
11523
|
+
* @property {FundsRequired} fundsRequired - The amount of funds required of this funding item
|
|
11524
|
+
* @property {UserBalance} userBalance - The current user balance of this funding item
|
|
11525
|
+
* @property {TokenInfo} token - The token info for the funding item
|
|
11526
|
+
*/
|
|
11527
|
+
type FundingItem = {
|
|
11528
|
+
type: ItemType.NATIVE | ItemType.ERC20;
|
|
11529
|
+
fundsRequired: FundsRequired;
|
|
11530
|
+
userBalance: UserBalance;
|
|
11531
|
+
token: TokenInfo;
|
|
11532
|
+
};
|
|
11533
|
+
/**
|
|
11534
|
+
* Represents the funds required of a funding item
|
|
11535
|
+
* @property {BigNumber} amount - The amount of funds required
|
|
11536
|
+
* @property {string} formattedAmount - The formatted amount of funds required
|
|
11537
|
+
*/
|
|
11538
|
+
type FundsRequired = {
|
|
11539
|
+
amount: BigNumber;
|
|
11540
|
+
formattedAmount: string;
|
|
11541
|
+
};
|
|
11542
|
+
/**
|
|
11543
|
+
* Represents the user balance of a funding item
|
|
11544
|
+
* @property {BigNumber} balance - The balance of the funding item
|
|
11545
|
+
* @property {string} formattedBalance - The formatted balance of the funding item
|
|
11546
|
+
*/
|
|
11547
|
+
type UserBalance = {
|
|
11548
|
+
balance: BigNumber;
|
|
11549
|
+
formattedBalance: string;
|
|
11550
|
+
};
|
|
11169
11551
|
/**
|
|
11170
11552
|
* Represents the transaction requirement for a transaction.
|
|
11171
11553
|
* @property {ItemType} type - The type of the transaction requirement.
|
|
@@ -11219,82 +11601,30 @@ type BalanceDelta = {
|
|
|
11219
11601
|
balance: BigNumber;
|
|
11220
11602
|
formattedBalance: string;
|
|
11221
11603
|
};
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
}
|
|
11604
|
+
/**
|
|
11605
|
+
* A type representing the Smart Checkout routing options available for a user
|
|
11606
|
+
* if they are configured and enabled (not geo-blocked etc.)
|
|
11607
|
+
*/
|
|
11608
|
+
type AvailableRoutingOptions = {
|
|
11609
|
+
onRamp?: boolean;
|
|
11610
|
+
swap?: boolean;
|
|
11611
|
+
bridge?: boolean;
|
|
11612
|
+
};
|
|
11232
11613
|
/**
|
|
11233
11614
|
* Interface representing the parameters for {@link Checkout.buy}
|
|
11234
11615
|
* @property {Web3Provider} provider - The provider to use for the buy.
|
|
11235
11616
|
* @property {Array<BuyOrder>} orders - The orders to buy
|
|
11617
|
+
* Currently only processes the first order in the array until batch processing is supported.
|
|
11236
11618
|
*/
|
|
11237
11619
|
interface BuyParams {
|
|
11238
11620
|
provider: Web3Provider;
|
|
11239
11621
|
orders: Array<BuyOrder>;
|
|
11240
11622
|
}
|
|
11241
|
-
/**
|
|
11242
|
-
* Interface representing the order to buy
|
|
11243
|
-
* @property {string} orderId - the id of the order to buy
|
|
11244
|
-
* @property {Array<OrderFee>} takerFees - array of order fees to apply to the order
|
|
11245
|
-
*/
|
|
11246
|
-
interface BuyOrder {
|
|
11247
|
-
id: string;
|
|
11248
|
-
takerFees?: Array<OrderFee>;
|
|
11249
|
-
}
|
|
11250
|
-
/**
|
|
11251
|
-
* Interface representing the result of the buy
|
|
11252
|
-
* @property {SmartCheckoutResult} smartCheckoutResult - The result of smart checkout.
|
|
11253
|
-
* @property {string} orderId - The order ID.
|
|
11254
|
-
* @property {BuyStatus} status - The status of the buy, present when smart checkout balances are sufficient
|
|
11255
|
-
* and the transactions were executed
|
|
11256
|
-
*/
|
|
11257
|
-
type BuyResult = {
|
|
11258
|
-
smartCheckoutResult: SmartCheckoutResult;
|
|
11259
|
-
orderId: string;
|
|
11260
|
-
status?: BuyStatus;
|
|
11261
|
-
};
|
|
11262
|
-
/**
|
|
11263
|
-
* Represents the status of the transaction for the Buy
|
|
11264
|
-
*/
|
|
11265
|
-
type BuyStatus = BuySuccessStatus | BuyFailedStatus;
|
|
11266
|
-
/**
|
|
11267
|
-
* Represents the status of a successful Buy
|
|
11268
|
-
* @property {string} type - The success buy status type.
|
|
11269
|
-
*/
|
|
11270
|
-
interface BuySuccessStatus {
|
|
11271
|
-
type: BuyStatusType.SUCCESS;
|
|
11272
|
-
}
|
|
11273
|
-
/**
|
|
11274
|
-
* Represents the status of a failed Buy
|
|
11275
|
-
* @property {string} type - The failed buy status type.
|
|
11276
|
-
* @property {string} transactionHash - The transaction hash of the failed transaction.
|
|
11277
|
-
* @property {string} reason - The reason for the failed transaction.
|
|
11278
|
-
*/
|
|
11279
|
-
interface BuyFailedStatus {
|
|
11280
|
-
type: BuyStatusType.FAILED;
|
|
11281
|
-
transactionHash: string;
|
|
11282
|
-
reason: string;
|
|
11283
|
-
}
|
|
11284
|
-
/**
|
|
11285
|
-
* A type representing the status of the transaction for the Buy
|
|
11286
|
-
* @enum {string}
|
|
11287
|
-
* @property {string} SUCCESS - All the transactions were successful.
|
|
11288
|
-
* @property {string} FAILED - At least one of the transactions failed.
|
|
11289
|
-
*/
|
|
11290
|
-
declare enum BuyStatusType {
|
|
11291
|
-
SUCCESS = "SUCCESS",
|
|
11292
|
-
FAILED = "FAILED"
|
|
11293
|
-
}
|
|
11294
11623
|
/**
|
|
11295
11624
|
* Interface representing the parameters for {@link Checkout.cancel}
|
|
11296
11625
|
* @property {Web3Provider} provider - The provider to use for the cancel.
|
|
11297
11626
|
* @property {string[]} orderIds - The order IDs to cancel.
|
|
11627
|
+
* Currently only processes the first order in the array until batch processing is supported.
|
|
11298
11628
|
*/
|
|
11299
11629
|
interface CancelParams {
|
|
11300
11630
|
provider: Web3Provider;
|
|
@@ -11591,104 +11921,12 @@ interface NetworkFilter {
|
|
|
11591
11921
|
* Interface representing the parameters for {@link Checkout.sell}
|
|
11592
11922
|
* @property {Web3Provider} provider - The provider to use for the sell.
|
|
11593
11923
|
* @property {Array<SellOrder>} orders - An array of sell orders to execute.
|
|
11594
|
-
*
|
|
11924
|
+
* Currently only processes the first order in the array until batch processing is supported.
|
|
11595
11925
|
*/
|
|
11596
11926
|
interface SellParams {
|
|
11597
11927
|
provider: Web3Provider;
|
|
11598
11928
|
orders: Array<SellOrder>;
|
|
11599
11929
|
}
|
|
11600
|
-
/**
|
|
11601
|
-
* Interface of the SellOrder to create a listing from, includes makerFees
|
|
11602
|
-
* @property {SellToken} sellToken - the token to be listed for sale
|
|
11603
|
-
* @property {BuyToken} buyToken - the token info of the price of the item
|
|
11604
|
-
* @property {OrderFee[]} makerFees - option array of makerFees to be applied to the listing
|
|
11605
|
-
*/
|
|
11606
|
-
interface SellOrder {
|
|
11607
|
-
sellToken: SellToken;
|
|
11608
|
-
buyToken: BuyToken;
|
|
11609
|
-
makerFees?: Array<OrderFee>;
|
|
11610
|
-
}
|
|
11611
|
-
/**
|
|
11612
|
-
* Interface of the SellToken
|
|
11613
|
-
* @property {string} id - The ERC721 token id
|
|
11614
|
-
* @property {string} collectionAddress - The ERC721 contract address
|
|
11615
|
-
*/
|
|
11616
|
-
interface SellToken {
|
|
11617
|
-
id: string;
|
|
11618
|
-
collectionAddress: string;
|
|
11619
|
-
}
|
|
11620
|
-
/**
|
|
11621
|
-
* Interface representing the result of the sell
|
|
11622
|
-
* @property {string} id - The ERC721 ID.
|
|
11623
|
-
* @property {string} collectionAddress - The contract address of the ERC721s collection.
|
|
11624
|
-
* @property {SmartCheckoutResult} smartCheckoutResult - The result of the smart checkout.
|
|
11625
|
-
* @property {SellStatus} status - The status of the sell, present when smart checkout balances are sufficient
|
|
11626
|
-
*/
|
|
11627
|
-
type SellResult = {
|
|
11628
|
-
id: string;
|
|
11629
|
-
collectionAddress: string;
|
|
11630
|
-
smartCheckoutResult: SmartCheckoutResult;
|
|
11631
|
-
status?: SellStatus;
|
|
11632
|
-
};
|
|
11633
|
-
/**
|
|
11634
|
-
* Represents the status of the transaction for the Sell
|
|
11635
|
-
*/
|
|
11636
|
-
type SellStatus = SellSuccessStatus | SellFailedStatus;
|
|
11637
|
-
/**
|
|
11638
|
-
* Represents the status of a successful Sell
|
|
11639
|
-
* @property {string} type - The success sell status type.
|
|
11640
|
-
* @property {string} orderId - The order ID of the listing.
|
|
11641
|
-
*/
|
|
11642
|
-
interface SellSuccessStatus {
|
|
11643
|
-
type: SellStatusType.SUCCESS;
|
|
11644
|
-
orderId: string;
|
|
11645
|
-
}
|
|
11646
|
-
/**
|
|
11647
|
-
* Represents the status of a failed Sell
|
|
11648
|
-
* @property {string} type - The failed sell status type.
|
|
11649
|
-
* @property {string} transactionHash - The transaction hash of the failed transaction.
|
|
11650
|
-
* @property {string} reason - The reason for the failed transaction.
|
|
11651
|
-
*/
|
|
11652
|
-
interface SellFailedStatus {
|
|
11653
|
-
type: SellStatusType.FAILED;
|
|
11654
|
-
transactionHash: string;
|
|
11655
|
-
reason: string;
|
|
11656
|
-
}
|
|
11657
|
-
/**
|
|
11658
|
-
* A type representing the status of the transaction for the Sell
|
|
11659
|
-
* @enum {string}
|
|
11660
|
-
* @property {string} SUCCESS - All the transactions were successful.
|
|
11661
|
-
* @property {string} FAILED - At least one of the transactions failed.
|
|
11662
|
-
*/
|
|
11663
|
-
declare enum SellStatusType {
|
|
11664
|
-
SUCCESS = "SUCCESS",
|
|
11665
|
-
FAILED = "FAILED"
|
|
11666
|
-
}
|
|
11667
|
-
/**
|
|
11668
|
-
* Represents the token that the item can be bought with once listed for sale.
|
|
11669
|
-
* NativeBuyToken or ERC20BuyToken {@link Checkout.smartCheckout}.
|
|
11670
|
-
*/
|
|
11671
|
-
type BuyToken = NativeBuyToken | ERC20BuyToken;
|
|
11672
|
-
/**
|
|
11673
|
-
* Represents a native buy token
|
|
11674
|
-
* @property {ItemType} type - The type indicate this is a native token.
|
|
11675
|
-
* @property {string} amount - The amount of native token.
|
|
11676
|
-
*/
|
|
11677
|
-
type NativeBuyToken = {
|
|
11678
|
-
type: ItemType.NATIVE;
|
|
11679
|
-
amount: string;
|
|
11680
|
-
};
|
|
11681
|
-
/**
|
|
11682
|
-
* Represents a ERC20 buy token
|
|
11683
|
-
* @property {ItemType} type - The type indicate this is a ERC20 token.
|
|
11684
|
-
* @property {string} amount - The amount of native token.
|
|
11685
|
-
* @property {string} contractAddress - The contract address of the ERC20.
|
|
11686
|
-
*/
|
|
11687
|
-
type ERC20BuyToken = {
|
|
11688
|
-
type: ItemType.ERC20;
|
|
11689
|
-
amount: string;
|
|
11690
|
-
contractAddress: string;
|
|
11691
|
-
};
|
|
11692
11930
|
/**
|
|
11693
11931
|
* Interface representing the parameters for {@link Checkout.getTokenAllowList}.
|
|
11694
11932
|
* @property {TokenFilterTypes} type - The type of token to retrieve.
|
|
@@ -12019,24 +12257,24 @@ declare class Checkout {
|
|
|
12019
12257
|
* Determines the requirements for performing a buy.
|
|
12020
12258
|
* @param {BuyParams} params - The parameters for the buy.
|
|
12021
12259
|
*/
|
|
12022
|
-
buy(params: BuyParams): Promise<
|
|
12260
|
+
buy(params: BuyParams): Promise<BuyResult>;
|
|
12023
12261
|
/**
|
|
12024
12262
|
* Determines the requirements for performing a sell.
|
|
12025
12263
|
* @param {SellParams} params - The parameters for the sell.
|
|
12026
12264
|
* Only currently actions the first order in the array until we support batch processing.
|
|
12027
12265
|
* Only currently actions the first fee in the fees array of each order until we support multiple fees.
|
|
12028
12266
|
*/
|
|
12029
|
-
sell(params: SellParams): Promise<
|
|
12267
|
+
sell(params: SellParams): Promise<SellResult>;
|
|
12030
12268
|
/**
|
|
12031
12269
|
* Cancels a sell.
|
|
12032
12270
|
* @param {CancelParams} params - The parameters for the cancel.
|
|
12033
12271
|
*/
|
|
12034
|
-
cancel(params: CancelParams): Promise<
|
|
12272
|
+
cancel(params: CancelParams): Promise<CancelResult>;
|
|
12035
12273
|
/**
|
|
12036
12274
|
* Determines the transaction requirements to complete a purchase.
|
|
12037
12275
|
* @params {SmartCheckoutParams} params - The parameters for smart checkout.
|
|
12038
12276
|
*/
|
|
12039
|
-
smartCheckout(params: SmartCheckoutParams): Promise<
|
|
12277
|
+
smartCheckout(params: SmartCheckoutParams): Promise<SmartCheckoutResult>;
|
|
12040
12278
|
/**
|
|
12041
12279
|
* Checks if the given object is a Web3 provider.
|
|
12042
12280
|
* @param {Web3Provider} web3Provider - The object to check.
|
|
@@ -12062,4 +12300,4 @@ declare class Checkout {
|
|
|
12062
12300
|
getExchangeFeeEstimate(): Promise<OnRampProviderFees>;
|
|
12063
12301
|
}
|
|
12064
12302
|
|
|
12065
|
-
export { AllowedNetworkConfig, BuyParams, BuyResult, CHECKOUT_API_BASE_URL, CancelParams, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemRequirement, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, OrderFee, RemoteConfiguration, SellOrder, SellParams, SellResult, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutParams, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
|
|
12303
|
+
export { AllowedNetworkConfig, BuyOrder, BuyParams, BuyResult, BuyToken, CHECKOUT_API_BASE_URL, CancelParams, CancelResult, ChainId, ChainName, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutStatus, ConnectParams, ConnectResult, DexConfig, ERC20ItemRequirement, ERC721ItemRequirement, ErrorType, ExchangeType, FeePercentage, FeeToken, FiatRampParams, FulfillmentTransaction, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetWalletAllowListParams, GetWalletAllowListResult, ItemRequirement, ItemType, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, OrderFee, RemoteConfiguration, SellOrder, SellParams, SellResult, SellToken, SendTransactionParams, SendTransactionResult, SmartCheckoutParams, SwitchNetworkParams, SwitchNetworkResult, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, WalletFilter, WalletFilterTypes, WalletInfo, WalletProviderName };
|