@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
61 lines (60 loc) • 2.72 kB
TypeScript
import { Contracts } from '../../lib/Contracts';
import { AccountOperationOptions, address, Buy, Call, ContractCallOptions, Deposit, Integer, Liquidate, Operation, Sell, SetApprovalForExpiry, SetExpiry, SignedOperation, Trade, Transfer, TxResult, Vaporize, Withdraw } from '../../types';
import { OrderMapper } from '../OrderMapper';
export declare class AccountOperation {
private contracts;
private actions;
private committed;
private orderMapper;
private accounts;
private proxy;
private sendEthTo;
private auths;
private networkId;
constructor(contracts: Contracts, orderMapper: OrderMapper, networkId: number, options: AccountOperationOptions);
deposit(deposit: Deposit): AccountOperation;
withdraw(withdraw: Withdraw): AccountOperation;
transfer(transfer: Transfer): AccountOperation;
buy(buy: Buy): AccountOperation;
sell(sell: Sell): AccountOperation;
liquidate(liquidate: Liquidate): AccountOperation;
vaporize(vaporize: Vaporize): AccountOperation;
setApprovalForExpiry(args: SetApprovalForExpiry): AccountOperation;
setExpiry(args: SetExpiry): AccountOperation;
call(args: Call): AccountOperation;
trade(trade: Trade): AccountOperation;
liquidateExpiredAccount(liquidate: Liquidate, maxExpiry?: Integer): AccountOperation;
fullyLiquidateExpiredAccount(primaryAccountOwner: address, primaryAccountNumber: Integer, expiredAccountOwner: address, expiredAccountNumber: Integer, expiredMarket: Integer, expiryTimestamp: Integer, blockTimestamp: Integer, weis: {
[marketId: string]: Integer;
}, prices: {
[marketId: string]: Integer;
}, spreadPremiums: {
[marketId: string]: Integer;
}, collateralPreferences: Integer[]): AccountOperation;
/**
* Adds all actions from a SignedOperation and also adds the authorization object that allows the
* proxy to process the actions.
*/
addSignedOperation(signedOperation: SignedOperation): AccountOperation;
/**
* Takes all current actions/accounts and creates an Operation struct that can then be signed and
* later used with the SignedOperationProxy.
*/
createSignableOperation(options?: {
expiration?: Integer;
salt?: Integer;
sender?: address;
signer?: address;
}): Operation;
/**
* Commits the operation to the chain by sending a transaction.
*/
commit(options?: ContractCallOptions): Promise<TxResult>;
private liquidateExpiredAccountInternal;
private fullyLiquidateExpiredAccountInternal;
private exchange;
private addActionArgs;
private getPrimaryAccountId;
private getAccountId;
private generateAuthData;
}