IMX Provider
Last updated
Last updated
A provider is an interface for abstracting the user's wallet implementation from the application, which enables the development of wallet-agnostic applications.
For the XpansionChain StarkEx network, XpansionChain has defined a Provider interface incorporating the IMX-specific signable actions, such as creating an order, withdrawals, and more.
The following list details all the signable actions supported by the IMX Provider along with definitions of the request and response payloads.
batchNftTransfer
cancelOrder
completeWithdrawal
createOrder
createTrade
deposit
exchangeTransfer
getAddress
isRegisteredOnchain
prepareWithdrawal
registerOffchain
transfer
▸ batchNftTransfer(request
): Promise
<CreateTransferResponse
>
Create a batch of NFT transfer requests
request
NftTransferDetails[]
An array of NFT transfer details
Promise
<CreateTransferResponse
>
Resolves a promise that resolves with the list of Transfer IDs
src/modules/provider/imxProvider.ts:73
▸ cancelOrder(request
): Promise
<CancelOrderResponse
>
Cancel an Order
request
GetSignableCancelOrderRequest
The signable cancel order request
Promise
<CancelOrderResponse
>
Returns a promise that resolves with the cancelled Order
src/modules/provider/imxProvider.ts:52
▸ completeWithdrawal(starkPublicKey
, token
): Promise
<TransactionResponse
>
Completes a Withdrawal
starkPublicKey
string
The stark public key
token
AnyToken
The token to withdraw
Promise
<TransactionResponse
>
Returns a promise that resolves with the transaction
src/modules/provider/imxProvider.ts:102
▸ createOrder(request
): Promise
<CreateOrderResponse
>
Create an Order
request
UnsignedOrderRequest
The unsigned order request to create an order
Promise
<CreateOrderResponse
>
Returns a promise that resolves with the created Order
src/modules/provider/imxProvider.ts:45
▸ createTrade(request
): Promise
<CreateTradeResponse
>
Create a Trade
request
GetSignableTradeRequest
The signable trade request
Promise
<CreateTradeResponse
>
Returns a promise that resolves with the created Trade
src/modules/provider/imxProvider.ts:59
▸ deposit(deposit
): Promise
<TransactionResponse
>
Deposit either ETH, ERC20 or ERC721 tokens
deposit
TokenAmount
Promise
<TransactionResponse
>
Returns a promise that resolves with the transaction
src/modules/provider/imxProvider.ts:87
▸ exchangeTransfer(request
): Promise
<CreateTransferResponseV1
>
Create a new Exchange transaction
request
UnsignedExchangeTransferRequest
The unsigned exchange transfer request
Promise
<CreateTransferResponseV1
>
Returns a promise that resolves with the created Exchange Transaction
src/modules/provider/imxProvider.ts:80
▸ getAddress(): Promise
<string
>
Get the Signer address
Promise
<string
>
Returns a promise that resolves with the signer's address
src/modules/provider/imxProvider.ts:26
▸ isRegisteredOnchain(): Promise
<boolean
>
Checks if a User is registered on-chain
Promise
<boolean
>
Returns a promise that resolves with true if the User is registered, false otherwise
src/modules/provider/imxProvider.ts:38
▸ prepareWithdrawal(request
): Promise
<CreateWithdrawalResponse
>
Create a Withdrawal
request
TokenAmount
The token type amount in its corresponding unit
Promise
<CreateWithdrawalResponse
>
Returns a promise that resolves with the created Withdrawal
src/modules/provider/imxProvider.ts:94
▸ registerOffchain(): Promise
<RegisterUserResponse
>
Register a User to XpansionChain if they are not already registered
Promise
<RegisterUserResponse
>
Returns a promise that resolves with the user registration response
src/modules/provider/imxProvider.ts:32
▸ transfer(request
): Promise
<CreateTransferResponseV1
>
Create a new Transfer request
request
UnsignedTransferRequest
The unsigned transfer request
Promise
<CreateTransferResponseV1
>
Returns a promise that resolves with the created Transfer
src/modules/provider/imxProvider.ts:66
token
ETHToken
| ERC721Token
| ERC20Token
ID of the cancelled order
An ETH token
Type
"ETH"
The string literal "ETH"
An ERC721 token
tokenAddress
string
The token address
tokenId
string
The token ID
type
"ERC721"
The string literal "ERC721"
An ERC20 token
tokenAddress
string
The token address
Type
"ERC20"
The string literal "ERC20"
TokenAmount
ETHToken
| ERC721Token
| ERC20Token
Union type that represents all token type amounts
ExchangeTokenAmount
ETHToken
| ERC20Token
Union type that represents exchange token type amounts
Amount
string
An amount in unit Wei
Type
ETH
Inherited from ETHToken
Amount
string
An amount in units for the given ERC20 token
Type
ERC20
Inherited from ERC20Token
tokenAddress
string
Inherited from ERC20Token
address
string
(Optional)
fee_percentage
number
receiver
string
Ethereum address of the receiving user
tokenAddress
string
The token contract address
tokenId
string
The token ID
transfer_ids
number[]
List of transfer IDs
order_id
number[]
ID of the order to be cancelled
order_id
number[]
ID of the cancelled order
status
string
New status of the order
buy
TokenAmount
The amount of tokens that will be bought for this order
expiration_timestamp
number
(Optional) ExpirationTimestamp in Unix time. Note: will be rounded down to the nearest hour
fees
FeeEntry[]
(Optional) Inclusion of either maker or taker fees
sell
TokenAmount
The amount of tokens that will be sold for this order
order_id
number
ID of the created order
request_id
string
(Optional) Request ID as a reference for an asynchronous order creation request
status
string
Status of the created order
time
number
Timestamp of the created order
expiration_timestamp
number
(Optional) ExpirationTimestamp in Unix time. Note: will be rounded down to the nearest hour
fees
FeeEntry[]`
Inclusion of either maker or taker fees
order_id
number
The ID of the maker order involved
user
string
Ethereum address of the submitting user
request_id
string
(Optional) Request ID as a reference for an asynchronous trade creation request
status
string
Current status of trade
trade_id
number
ID of trade within XpansionChain
receiver
string
Ethereum address of the receiving user
transactionID
string
The transaction ID
ExchangeTokenAmount
ExchangeTokenAmount
Union type that represents exchange token type amounts
TokenAmount
TokenAmount
Union type that represents all token type amounts
receiver
string
New status of the order
transfer_id
number
ID of the transfer
time
number
[deprecated] Time of the transfer
status
string
[deprecated] The status of transfer
sent_signature
string
[deprecated] Sent signature
tx_hash
string
XpansionChain signature authorising registration
tx_hash
string
XpansionChain signature authorising registration
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Parameters
Returns
Defined in
Returns
Defined in
Returns
Defined in
Parameters
Returns
Defined in
Returns
Defined in
Parameters
Returns
Defined in