Providers
Providers are the blockchain connectors. A provider is instantiated internally based on the network name provided on initialization.
- LocalProvider
- JungleProvider
- Jungle3Provider
- BosProvider
- WorbliProvider
- KylinProvider
- MainProvider
- CustomProvider
const eoslime = require('eoslime').init('jungle') -> JungleProvider
- network
{
name: 'network name',
url: 'node endpoint',
chainId: 'chain id'
}
- defaultAccountThe default/main account from which the blockchain transactions are executed
- eoseosjs instance that serves as a bridge with the blockchain
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
const eoslimeInstance = eoslime.init();
const localProvider = eoslimeInstance.Provider;
assert(JSON.stringify(localProvider.network) == JSON.stringify(Networks.local));
const localAccount = await eoslimeInstance.Account.createRandom();
assert(JSON.stringify(localAccount.provider.network) == JSON.stringify(Networks.local));
const jungleProvider = new eoslimeInstance.Provider('jungle');
eoslimeInstance.Provider.reset(jungleProvider);
assert(JSON.stringify(localAccount.provider.network) == JSON.stringify(Networks.jungle));
assert(JSON.stringify(eoslimeInstance.Provider.network) == JSON.stringify(Networks.jungle));
Returns contract ABI in JSON format
const abiJSON = await Provider.getABI('contract name');
Returns raw WASM useful for deploying another contract directly
const rawWASM = await Provider.getRawWASM('contract name');
In order to be easier for developers to read from a table we have implemented query chain like table search.
Provider.select('table').from('contract name')
.equal()
.range()
.limit()
.index()
.find();
Every query should ends with find() in order to be executed.
- Required parameters
- tabletName
Provider.select('table')
Possible next subqueries
- from
- Required parameters
- contractName
Provider.select('table').from('contract name')
Possible next subqueries
- scope
- find
- equal
- range
- limit
- index
- Required parameters
- accountName
If you skip scope, the default one will be set to the from
Provider.select('table').from('contract name').scope('account name')
Possible next subqueries
- find
- equal
- range
- limit
- index
- Required parameters
- value
Provider.select('table').from('contract name').equal(5)
Possible next subqueries
- find
- limit
- index
- Required parameters
- from
- to
Provider.select('table').from('contract name').range(1, 5)
Possible next subqueries
- find
- limit
- index
- Required parameters
- index
- Optional parameters
- indexType = i64
Provider.select('table').from('contract name').index(1)
Possible next subqueries
- find
- limit
- equal
- range
- Required parameters
- value
Provider.select('table').from('contract name').limit(1)
Possible next subqueries
- find
- index
- equal
- range
Provider.select('table').from('contract name').find()
Last modified 2yr ago