Eoslime
Search…
Providers
Providers are the blockchain connectors. A provider is instantiated internally based on the network name provided on initialization.

Available Providers

  • LocalProvider
  • JungleProvider
  • Jungle3Provider
  • BosProvider
  • WorbliProvider
  • KylinProvider
  • MainProvider
  • CustomProvider
1
const eoslime = require('eoslime').init('jungle') -> JungleProvider
Copied!

Properties

  • network
1
{
2
name: 'network name',
3
url: 'node endpoint',
4
chainId: 'chain id'
5
}
Copied!
  • defaultAccount
    The default/main account from which the blockchain transactions are executed
  • eos
    eosjs instance that serves as a bridge with the blockchain

Functions

reset

Reset the provider to another one
If you reset the provider, the whole eoslime and all of it's objects will change entirely the old provider with the new one
1
const eoslimeInstance = eoslime.init();
2
3
const localProvider = eoslimeInstance.Provider;
4
assert(JSON.stringify(localProvider.network) == JSON.stringify(Networks.local));
5
6
const localAccount = await eoslimeInstance.Account.createRandom();
7
assert(JSON.stringify(localAccount.provider.network) == JSON.stringify(Networks.local));
8
9
const jungleProvider = new eoslimeInstance.Provider('jungle');
10
eoslimeInstance.Provider.reset(jungleProvider);
11
12
assert(JSON.stringify(localAccount.provider.network) == JSON.stringify(Networks.jungle));
13
assert(JSON.stringify(eoslimeInstance.Provider.network) == JSON.stringify(Networks.jungle));
Copied!

getABI(contractName)

Returns contract ABI in JSON format
1
const abiJSON = await Provider.getABI('contract name');
Copied!

getRawWASM(contractName)

Returns raw WASM useful for deploying another contract directly
1
const rawWASM = await Provider.getRawWASM('contract name');
Copied!

Query Chain Style

In order to be easier for developers to read from a table we have implemented query chain like table search.
1
Provider.select('table').from('contract name')
2
.equal()
3
.range()
4
.limit()
5
.index()
6
.find();
Copied!
Every query should ends with find() in order to be executed.

select(tableName)

  • Required parameters
    • tabletName
1
Provider.select('table')
Copied!
Possible next subqueries
  • from

from(contractName)

  • Required parameters
    • contractName
1
Provider.select('table').from('contract name')
Copied!
Possible next subqueries
  • scope
  • find
  • equal
  • range
  • limit
  • index

scope(accountName)

  • Required parameters
    • accountName
If you skip scope, the default one will be set to the from
1
Provider.select('table').from('contract name').scope('account name')
Copied!
Possible next subqueries
  • find
  • equal
  • range
  • limit
  • index

equal(value)

  • Required parameters
    • value
1
Provider.select('table').from('contract name').equal(5)
Copied!
Possible next subqueries
  • find
  • limit
  • index

range(from, to)

  • Required parameters
    • from
    • to
1
Provider.select('table').from('contract name').range(1, 5)
Copied!
Possible next subqueries
  • find
  • limit
  • index

index(index, indexType)

  • Required parameters
    • index
  • Optional parameters
    • indexType = i64
1
Provider.select('table').from('contract name').index(1)
Copied!
Possible next subqueries
  • find
  • limit
  • equal
  • range

limit(value)

  • Required parameters
    • value
1
Provider.select('table').from('contract name').limit(1)
Copied!
Possible next subqueries
  • find
  • index
  • equal
  • range

find()

1
Provider.select('table').from('contract name').find()
Copied!
Last modified 1yr ago