aftr-market
v1.1.77
Published
Library to interact with AFTR Market
Downloads
24
Readme
AFTR is a protocol that groups or encapsulates assets in the Arweave ecosystem. The first use case is called AFTR.Market which presets treasury management and governance for Arweave assets.
// When you update the repository(code), make sure you build it so that it's ready for the run
npm run build
// When you publish your code make sure your version(in package,json) always updated. and after that use followig command to pulish your library.
npm publish
Installation Package Command
npm install aftr-market
js
Library to interact with AFTR Market
Initialization
import Aftr from "aftr-market";
const client = new Aftr();
Usage
The library supports data requests and interactions with the protocol:
Create Vehicle
// example usage to access the create vehicle function await client.vehicle.createVehicle(...);
Adding a new vehicle.
await client.vehicle.createVehicle(vehicleObject, wallet, options)
The function takes three params:
- vehicleObject: json object that defines the vehicle (the object should follow the state interface in the faces.ts file)
- wallet: Optional. In order to create the contract (this is a keyfile object or the “use_wallet” string if the developer is using this in a browser with Arconnect).
- options - optional object that defines optional parameters such as testnet.
- Parameters - If the options object is specified, then the createVehicle method will use these values as opposed to the hardcoded values in the code.
- aftrSourceContractId: string
- aftrProtocolTag: string (the Protocol tag is hardcoded for production as “AFTR”) - The protocol tag is always required, so if it’s not specified in the options object, it is hardcoded in the code.
- customTags: array of {name: “”, value: “”} - this gives the user the opportunity to add custom tags
- Example options object:
{ aftrSourceContractId: <string>, // Allows user to add a contract Id for test purposes. If no value is supplied, then the hardcoded value is used. aftrProtocolTag: "AFTR-BETA", // Allows user to customize Protocol tag. If no value provided, "AFTR" is hardcoded. customTags: [ { "<CUSTOM_NAME>": "<CUSTOM_VALUE>" }, // Allows user to add tags ] }
- Parameters - If the options object is specified, then the createVehicle method will use these values as opposed to the hardcoded values in the code.
The function returns the created vehicle ID.
Edit Vehicle
Edit the existing vehicle.
await client.vehicle.editVehicle(wallet, vehicleId, [{"name" : "test-2"}, {"ticker" : "CHILL-1"}])
The function takes three params:
- wallet: Optional. In order to create the contract (this is a keyfile object or the “use_wallet” string if the developer is using this in a browser with Arconnect).
- vehicleId - Contract ID of the vehicle to be edited
- changeMap(Array of object) - map of items to be changed