algokit-algod-api 1.0.0-alpha.10
Install from the command line:
Learn more about npm packages
$ npm install @algorandfoundation/algokit-algod-api@1.0.0-alpha.10
Install via package.json:
"@algorandfoundation/algokit-algod-api": "1.0.0-alpha.10"
About this version
@algorandfoundation/[email protected]
This generator creates TypeScript/JavaScript client that utilizes fetch-api.
To build and compile the typescript sources to javascript use:
npm install
npm run build
First build the package then run npm publish
Navigate to the folder of your consuming project and run one of the following commands.
published:
npm install @algorandfoundation/[email protected] --save
unPublished (not recommended):
npm install PATH_TO_GENERATED_PACKAGE --save
Below code snippet shows exemplary usage of the configuration and the API based
on the typical PetStore
example used for OpenAPI.
import * as algodApi from '@algorandfoundation/algokit-algod-api'
// Covers all auth methods included in your OpenAPI yaml definition
const authConfig: algodApi.AuthMethodsConfiguration = {
"api_key": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
// Create configuration parameter object
const serverConfig = new algodApi.ServerConfiguration('http://localhost:4001', {})
const configurationParameters = {
httpApi: new algodApi.IsomorphicFetchHttpLibrary(), // Can also be ignored - default is usually fine
baseServer: serverConfig, // First server is default
authMethods: authConfig, // No auth is default
promiseMiddleware: [],
}
// Convert to actual configuration
const config = algodApi.createConfiguration(configurationParameters);
// Use configuration with your_api
const api = new algodApi.AlgodApi(config);
const response = await api.transactionParams()
console.log(response?.lastRound)
To run the tests, use the following command:
npm run test
Details
- algokit-algod-api
-
algorandfoundation
- 10 days ago
- Unlicense
- 8 dependencies
Assets
- algokit-algod-api-1.0.0-alpha.10.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0