import { BigNumber } from "ethers/utils" ; import { AppInterface , SolidityValueType } from "." ; export type TwoPartyFixedOutcomeInterpreterParams = { playerAddrs : [ string , string ] ; amount : string ; tokenAddress : string ; } ; export type MultiAssetMultiPartyCoinTransferInterpreterParams = { limit : string [ ] ; tokenAddresses : string [ ] ; } ; export type SingleAssetTwoPartyCoinTransferInterpreterParams = { limit : string ; tokenAddress : string ; } ; export const multiAssetMultiPartyCoinTransferInterpreterParamsEncoding = `
  tuple(
    uint256[] limit,
    address[] tokenAddresses
  )
` ; export const singleAssetTwoPartyCoinTransferInterpreterParamsEncoding = `
  tuple(uint256 limit, address tokenAddress)
` ; export const twoPartyFixedOutcomeInterpreterParamsEncoding = `
  tuple(address[2] playerAddrs, uint256 amount)
` ; export const virtualAppAgreementEncoding = `
  tuple(
    uint256 capitalProvided,
    address capitalProvider,
    address virtualAppUser,
    address tokenAddress,
  )
` ; export const multiAssetMultiPartyCoinTransferEncoding = `
    tuple(
      address to,
      uint256 amount
    )[][]
` ; export type AppInstanceJson = { identityHash : string ; participants : string [ ] ; defaultTimeout : number ; appInterface : AppInterface ; isVirtualApp : boolean ; appSeqNo : number ; latestState : SolidityValueType ; latestVersionNumber : number ; latestTimeout : number ; outcomeType : OutcomeType ; /**
     * Interpreter-related Fields
     */ twoPartyOutcomeInterpreterParams ? : TwoPartyFixedOutcomeInterpreterParams ; multiAssetMultiPartyCoinTransferInterpreterParams ? : MultiAssetMultiPartyCoinTransferInterpreterParams ; singleAssetTwoPartyCoinTransferInterpreterParams ? : SingleAssetTwoPartyCoinTransferInterpreterParams ; } ; export type AppInstanceInfo = { identityHash : string ; appDefinition : string ; abiEncodings : AppABIEncodings ; initiatorDeposit : BigNumber ; initiatorDepositTokenAddress : string ; responderDeposit : BigNumber ; responderDepositTokenAddress : string ; timeout : BigNumber ; proposedByIdentifier : string ; proposedToIdentifier : string ; intermediaryIdentifier ? : string ; /**
     * Interpreter-related Fields
     */ twoPartyOutcomeInterpreterParams ? : TwoPartyFixedOutcomeInterpreterParams ; multiAssetMultiPartyCoinTransferInterpreterParams ? : MultiAssetMultiPartyCoinTransferInterpreterParams ; singleAssetTwoPartyCoinTransferInterpreterParams ? : SingleAssetTwoPartyCoinTransferInterpreterParams ; } ; export type AppInstanceProposal = { abiEncodings : AppABIEncodings ; appDefinition : string ; appSeqNo : number ; identityHash : string ; initialState : SolidityValueType ; initiatorDeposit : string ; initiatorDepositTokenAddress : string ; intermediaryIdentifier ? : string ; outcomeType : OutcomeType ; proposedByIdentifier : string ; proposedToIdentifier : string ; responderDeposit : string ; responderDepositTokenAddress : string ; timeout : string ; /**
     * Interpreter-related Fields
     */ twoPartyOutcomeInterpreterParams ? : TwoPartyFixedOutcomeInterpreterParams ; multiAssetMultiPartyCoinTransferInterpreterParams ? : MultiAssetMultiPartyCoinTransferInterpreterParams ; singleAssetTwoPartyCoinTransferInterpreterParams ? : SingleAssetTwoPartyCoinTransferInterpreterParams ; } ; export type AppABIEncodings = { stateEncoding : string ; actionEncoding : string | undefined ; } ; export enum OutcomeType { TWO_PARTY_FIXED_OUTCOME = "TWO_PARTY_FIXED_OUTCOME" , MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER = "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" , SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER = "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER" } export enum TwoPartyFixedOutcome { SEND_TO_ADDR_ONE = 0 , SEND_TO_ADDR_TWO = 1 , SPLIT_AND_SEND_TO_BOTH_ADDRS = 2 } export type CoinBalanceRefundState = { recipient : string ; multisig : string ; threshold : BigNumber ; tokenAddress : string ; } ; export const coinBalanceRefundStateEncoding = `
  tuple(
    address recipient,
    address multisig,
    uint256 threshold,
    address tokenAddress
  )
` ;