Skip to main content
Version: v1

IMX Provider

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 Immutable StarkEx network, Immutable 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.

IMXProvider Methods​

Method Details​

batchNftTransfer​

▸ batchNftTransfer(request): Promise<CreateTransferResponse>

Create a batch of NFT transfer requests

Parameters​

NameTypeDescription
requestNftTransferDetails[]An array of NFT transfer details

Limitation: less than 40 nfts/request

Returns​

Promise<CreateTransferResponse>

Resolves a promise that resolves with the list of Transfer IDs

Defined in​

src/modules/provider/imxProvider.ts:73


cancelOrder​

▸ cancelOrder(request): Promise<CancelOrderResponse>

Cancel an Order or Offer

Parameters​

NameTypeDescription
requestGetSignableCancelOrderRequestThe signable cancel order request

Returns​

Promise<CancelOrderResponse>

Returns a promise that resolves with the cancelled Order

Defined in​

src/modules/provider/imxProvider.ts:52


completeWithdrawal​

▸ completeWithdrawal(starkPublicKey, token): Promise<TransactionResponse>

Completes a Withdrawal

Parameters​

NameTypeDescription
starkPublicKeystringThe stark public key
tokenAnyTokenThe token to withdraw

Returns​

Promise<TransactionResponse>

Returns a promise that resolves with the transaction

Defined in​

src/modules/provider/imxProvider.ts:102


createOrder​

▸ createOrder(request): Promise<CreateOrderResponse>

The function used to create an Order or make an Offer

Parameters​

NameTypeDescription
requestUnsignedOrderRequestThe unsigned order request to create an order, or make an offer

Returns​

Promise<CreateOrderResponse>

Returns a promise that resolves with the created Order

Defined in​

src/modules/provider/imxProvider.ts:45


createTrade​

▸ createTrade(request): Promise<CreateTradeResponse>

Create a Trade or Accept an Offer

Parameters​

NameTypeDescription
requestGetSignableTradeRequestThe signable trade request

Returns​

Promise<CreateTradeResponse>

Returns a promise that resolves with the created Trade

Defined in​

src/modules/provider/imxProvider.ts:59


deposit​

▸ deposit(deposit): Promise<TransactionResponse>

Deposit either ETH, ERC20 or ERC721 tokens

Parameters​

NameType
depositTokenAmount

Returns​

Promise<TransactionResponse>

Returns a promise that resolves with the transaction

Defined in​

src/modules/provider/imxProvider.ts:87


exchangeTransfer​

▸ exchangeTransfer(request): Promise<CreateTransferResponseV1>

Create a new Exchange transaction

Parameters​

NameTypeDescription
requestUnsignedExchangeTransferRequestThe unsigned exchange transfer request

Returns​

Promise<CreateTransferResponseV1>

Returns a promise that resolves with the created Exchange Transaction

Defined in​

src/modules/provider/imxProvider.ts:80


getAddress​

▸ getAddress(): Promise<string>

Get the Signer address

Returns​

Promise<string>

Returns a promise that resolves with the signer's address

Defined in​

src/modules/provider/imxProvider.ts:26


isRegisteredOnchain​

▸ isRegisteredOnchain(): Promise<boolean>

Checks if a User is registered on-chain

Returns​

Promise<boolean>

Returns a promise that resolves with true if the User is registered, false otherwise

Defined in​

src/modules/provider/imxProvider.ts:38


prepareWithdrawal​

▸ prepareWithdrawal(request): Promise<CreateWithdrawalResponse>

Create a Withdrawal

Parameters​

NameTypeDescription
requestTokenAmountThe token type amount in its corresponding unit

Returns​

Promise<CreateWithdrawalResponse>

Returns a promise that resolves with the created Withdrawal

Defined in​

src/modules/provider/imxProvider.ts:94


isRegisteredOffchain​

▸ isRegisteredOffchain(): Promise<boolean>

Checks if a User is registered off-chain

Returns​

Promise<boolean>

Returns a promise that resolves with true if the User is registered with Immutable X, false otherwise

Defined in​

src/modules/provider/imxProvider.ts:38


registerOffchain​

▸ registerOffchain(): Promise<RegisterUserResponse>

Register a User to Immutable X if they are not already registered

Returns​

Promise<RegisterUserResponse>

Returns a promise that resolves with the user registration response

Defined in​

src/modules/provider/imxProvider.ts:32


transfer​

▸ transfer(request): Promise<CreateTransferResponseV1>

Create a new Transfer request

Parameters​

NameTypeDescription
requestUnsignedTransferRequestThe unsigned transfer request

Returns​

Promise<CreateTransferResponseV1>

Returns a promise that resolves with the created Transfer

Defined in​

src/modules/provider/imxProvider.ts:66


Types​

AnyToken​

NameTypeDescription
tokenETHToken | ERC721Token | ERC20TokenID of the cancelled order

EthToken​

An ETH token

NameTypeDescription
Type"ETH"The string literal "ETH"

ERC721Token​

An ERC721 token

NameTypeDescription
tokenAddressstringThe token address
tokenIdstringThe token ID
type"ERC721"The string literal "ERC721"

ERC20Token​

An ERC20 token

NameTypeDescription
tokenAddressstringThe token address
Type"ERC20"The string literal "ERC20"

TokenAmount​

NameTypeDescription
TokenAmountETHToken | ERC721Token | ERC20TokenUnion type that represents all token type amounts

ExchangeTokenAmount​

NameTypeDescription
ExchangeTokenAmountETHToken | ERC20TokenUnion type that represents exchange token type amounts

ETHAmount​

NameTypeDescription
AmountstringAn amount in unit Wei
TypeETHInherited from ETHToken

ERC20Amount​

NameTypeDescription
AmountstringAn amount in units for the given ERC20 token
TypeERC20Inherited from ERC20Token
tokenAddressstringInherited from ERC20Token

FeeEntry​

NameTypeDescription
addressstring(Optional)
fee_percentagenumber

Request & Response Types​

NftTransferDetails​

NameTypeDescription
receiverstringEthereum address of the receiving user
tokenAddressstringThe token contract address
tokenIdstringThe token ID

CreateTransferResponse​

NameTypeDescription
transfer_idsnumber[]List of transfer IDs

GetSignableCancelOrderRequest​

NameTypeDescription
order_idnumberID of the order/offer to be cancelled

CancelOrderResponse​

NameTypeDescription
order_idnumberID of the cancelled order / offer
statusstringNew status of the order / offer

UnsignedOrderRequest​

NameTypeDescription
buyTokenAmountFor create an order, this is the amount of tokens that will be bought for this order, normally the ERC20 or ETH. For make an offer, This is the amount of tokens that will be bought for this offer, normally the ERC721
expiration_timestampnumber(Optional) ExpirationTimestamp in Unix time. Note: will be rounded down to the nearest hour
feesFeeEntry[](Optional) Inclusion of either maker or taker fees
sellTokenAmountFor create an order, this is the amount of tokens that will be sold for this order, normally the ERC721. For make an offer, This is the amount of tokens that offered for this order, normally the ERC20 or ETH

CreateOrderResponse​

NameTypeDescription
order_idnumberID of the created order / offer
request_idstring(Optional) Request ID as a reference for an asynchronous order creation request
statusstringStatus of the created order / offer
timenumberTimestamp of the created order / offer

GetSignableTradeRequest​

NameTypeDescription
expiration_timestampnumber(Optional) ExpirationTimestamp in Unix time. Note: will be rounded down to the nearest hour
feesFeeEntry[]`Inclusion of either maker or taker fees
order_idnumberThe ID of the maker order / offer involved
userstringEthereum address of the submitting user

CreateTradeResponse​

NameTypeDescription
request_idstring(Optional) Request ID as a reference for an asynchronous trade creation/order acception request
statusstringCurrent status of trade(the trade will be created after user accept the offer, this is the current status of trade)
trade_idnumberID of trade within Immutable X

UnsignedExchangeTransferRequest​

NameTypeDescription
receiverstringEthereum address of the receiving user
transactionIDstringThe transaction ID
ExchangeTokenAmountExchangeTokenAmountUnion type that represents exchange token type amounts

UnsignedTransferRequest​

NameTypeDescription
TokenAmountTokenAmountUnion type that represents all token type amounts
receiverstringNew status of the order

CreateTransferResponseV1​

NameTypeDescription
transfer_idnumberID of the transfer
timenumber[deprecated] Time of the transfer
statusstring[deprecated] The status of transfer
sent_signaturestring[deprecated] Sent signature

CreateWithdrawalResponse​

NameTypeDescription
tx_hashstringImmutable signature authorising registration

RegisterUserResponse​

NameTypeDescription
tx_hashstringImmutable signature authorising registration