docs: smartweave global (#308)
This commit is contained in:
54
README.md
54
README.md
@@ -36,6 +36,7 @@ If you are interested in the main assumptions for Warp ecosystem as well as its
|
||||
- [Internal writes](#internal-writes)
|
||||
- [UnsafeClient](#unsafeclient)
|
||||
- [Cache](#cache)
|
||||
- [SmartWeave Global API](#smartweave-global-api)
|
||||
- [CLI](#cli)
|
||||
- [Examples](#examples)
|
||||
- [Migrations](#migrations)
|
||||
@@ -584,6 +585,59 @@ You can also supply your own implementation of the `SortKeyCache` interface and
|
||||
In order to use custom implementation call either `useStateCache` or `useContractCache` on `warp` instance.
|
||||
An example - LMDB - implementation is available [here](https://github.com/warp-contracts/warp-contracts-lmdb#warp-contracts-lmdb-cache).
|
||||
|
||||
### SmartWeave Global API
|
||||
|
||||
All contracts have access to a global object `SmartWeave`. It provides access to additional API for getting further information or using utility and crypto functions from inside the contracts execution. It also allows to interact with other contracts and read other contracts states.
|
||||
|
||||
List of available options:
|
||||
|
||||
* transaction informations:
|
||||
- SmartWeave.transaction.id
|
||||
- SmartWeave.transaction.owner
|
||||
- SmartWeave.transaction.tags
|
||||
- SmartWeave.transaction.quantity
|
||||
- SmartWeave.transaction.reward
|
||||
|
||||
* contract
|
||||
- SmartWeave.contract.id
|
||||
- SmartWeave.contract.owner
|
||||
|
||||
* contracts
|
||||
- readContractState(contractId: string)
|
||||
- viewContractState(contractId: string, input: any)
|
||||
- write(contractId: string, input: any)
|
||||
- refreshState()
|
||||
|
||||
* block informations:
|
||||
- SmartWeave.block.height
|
||||
- SmartWeave.block.timestamp
|
||||
- SmartWeave.block.indep_hash
|
||||
|
||||
* Arweave utils
|
||||
- SmartWeave.arweave.utils
|
||||
- SmartWeave.arweave.crypto
|
||||
- SmartWeave.arweave.wallets
|
||||
- SmartWeave.arweave.ar
|
||||
|
||||
* potentially non-deterministic full Arweave client:
|
||||
- SmartWeave.unsafeClient
|
||||
|
||||
* evaluation options
|
||||
- SmartWeave.evaluationOptions
|
||||
|
||||
* VRF
|
||||
- SmartWeave.vrf.data
|
||||
- SmartWeave.vrf.value
|
||||
- SmartWeave.vrf.randomInt(maxValue: number)
|
||||
|
||||
* other
|
||||
- SmartWeave.useGas(gas: number)
|
||||
- SmartWeave.getBalance(address: string, height?: number)
|
||||
- SmartWeave.gasUsed
|
||||
- SmartWeave.gasLimit
|
||||
|
||||
* extensions - additional `SmartWeave` options which can be for example injected through dedicated plugins (an example of such in [`warp-contracts-plugins` repository](https://github.com/warp-contracts/warp-contracts-plugins)).
|
||||
|
||||
### CLI
|
||||
|
||||
A dedicated CLI which eases the process of using main methods of the Warp SDK library has been created. Please refer to [`warp-contracts-cli` npm page](https://www.npmjs.com/package/warp-contracts-cli) for more details.
|
||||
|
||||
Reference in New Issue
Block a user