Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Getline client library.

This library lets you view and manage Getline.in loans programatically. It runs under node.js and in Chrome with the Metamask extension. You will be automatically logged in as the first address from your web3 provider.

The library is fully async/await compatible, which means you can use it both with Promise.then/.catch and await blocks. All calls that interact with the blockchain will block until the result propagates.

Currently this library only allows you to create loans on the Rinkeby testnet - this is by design until we go out of demo.

Hierarchy

  • Client

Index

Constructors

constructor

  • new Client(metabackend: string, network: string, provider?: Web3.Provider): Client
  • Creates a new Getline client.

    Parameters

    • metabackend: string

      Address of metabackend. Production address is https://0.api.getline.in.

    • network: string

      Network identifier. Currently only "4" (Rinkeby) is supported.

    • Optional provider: Web3.Provider

      Web3 provider to use. If not given, the client will try to find an injected one from Metamask. Otherwise, it will fall back to http://localhost:8545/.

    Returns Client

Properties

Private blockchain

blockchain: GetlineBlockchain

Private metabackend

metabackend: MetabackendClient

Private network

network: string

testToken

testToken: PrintableToken

Token that is used for collateral and loans in the demo.

Methods

currentUser

loan

  • loan(shortId: string): Promise<Loan>
  • Returns loan identifier by a given short identifier.

    Parameters

    • shortId: string

      Short identifier of loan (shortId member of a Loan object).

    Returns Promise<Loan>

    Loan identifier by shortId.

loansByOwner

  • Returns all loans owned by a given address, regardless of their state.

    Parameters

    • owner: Address

      Ethereum address of owner/liege.

    Returns Promise<Array<Loan>>

    Loans owned by owner.

newLoan

  • newLoan(description: string, amount: BigNumber, interestPermil: number, fundraisingEnd: Moment, paybackEnd: Moment): Promise<Loan>
  • Creates a new Getline Loan on the blockchain and indexes it in the Getline system.

    Currently these loans use TEST_TOKEN as both the collateral and loan token. This will be changed in the future.

    Parameters

    • description: string

      Human-readable description of loan. Markdown.

    • amount: BigNumber

      Amount of loan requested.

    • interestPermil: number

      Loan interest in permil.

    • fundraisingEnd: Moment
    • paybackEnd: Moment

    Returns Promise<Loan>

    Newly created loan.

Generated using TypeDoc