Skip to content

A Javascript Based client for AssetMantle

License

Notifications You must be signed in to change notification settings

sohailgi/mantlejs

 
 

Repository files navigation

AssetMantle

MantleJS

License: Apache-2.0 Lines Of Code Version

Client side JS libraries for AssetMantle SDK transaction generation, signing and broadcasting.

Contributing

If you want to contribute to MantleJS, please read the instructions in CODING_GUIDELINES.md.

Discord Twitter Reddit Twitter

Contributors


Installation

Node

npm install @assetmantle/mantlejs

OR

npm install "https://github.com/AssetMantle/mantlejs.git"

Yarn

yarn add @assetmantle/mantlejs

OR

yarn add "https://github.com/AssetMantle/mantlejs.git"

Example Usage

import {queryIdentities} from "mantlejs/build/transaction/identity/query";

// get the queryIdentities controller object to perform the query
const queryIdentitiesControllerObj = new queryIdentities(process.env.REACT_APP_ASSET_MANTLE_API);

const handleSubmit = async event => {
        event.preventDefault();
        const IdentityName = event.target.identityname.value;
        // create double hash
        const hashGenerate = GetMetaHelper.Hash(GetMetaHelper.Hash(IdentityName));
        // build identityID using nub classificationID and the generated hash
        const identityID = config.nubClassificationID+'|'+hashGenerate;
        // query identities in the chain associated with the particular identityID
        const identitiesPromise = queryIdentitiesControllerObj.queryIdentityWithID(identityID);
}

API List

The list of critical JS API endpoints which acts as the interface to the AssetMantle SDK, used for rapid Javascript based DApp prototyping

transaction / identity

APIs pertaining to manipulating the 'identity', a DID based entity used to represent identity of user.

defineIdentity.define

used to define an identity entity. Defines a message and initiates the transaction.

Function Signature

define: (address: string, chain_id: string, mnemonic: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string) => Promise<any>;

---------------

defineIdentity.createIdentityDefineMsg

used to define an identity entity. Only defines and outputs a message object.

Function Signature

createIdentityDefineMsg: (address: string, chain_id: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, memo: string) => Promise<any>;

---------------

issueIdentity.issue

used to issue an identity entity. Defines a message and initiates the transaction.

Function Signature

issue: (address: string, chain_id: string, mnemonic: any, to: any, fromID: string, classificationID: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string) => Promise<any>;

---------------

issueIdentity.createIdentityIssueMsg

used to issue an identity entity. Only defines and outputs a message object.

Function Signature

createIdentityIssueMsg: (address: string, chain_id: string, to: any, fromID: string, classificationID: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, memo: string) => Promise<any>;

---------------

nubIdentity.nub

used to create a nub ID, which is the simplest but complete and valid unit of identification. Defines a message and initiates the transaction.

Function Signature

nub: (address: string, chain_id: string, mnemonic: any, nubID: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string) => Promise<any>;

---------------

nubIdentity.createIdentityNubMsg

used to create a nub ID, which is the simplest but complete and valid unit of identification. Only defines and outputs a message object.

Function Signature

createIdentityNubMsg: (address: string, chain_id: string, nubID: any, feesAmount: any, feesToken: any, gas: any, memo: string) => Promise<any>;

---------------

provisionIdentity.provision

used to create a provision address which is used to control / operate an identity. a nub ID, which is the simplest but complete and valid unit of identification. Defines a message and initiates the transaction.

Function Signature

provision: (address: string, chain_id: string, mnemonic: any, identityID: any, to: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string) => Promise<any>;

---------------

provisionIdentity.createIdentityProvisionMsg

used to create a provision address which is used to control / operate an identity. Only defines and outputs a message object

Function Signature

createIdentityProvisionMsg: (address: string, chain_id: string, identityID: any, to: any, feesAmount: any, feesToken: any, gas: any, memo: string) => Promise<any>;

---------------

queryIdentities.queryIdentity

used to query the list of all identities. Defines a message and initiates the transaction.

Function Signature

queryIdentity: () => Promise<any>;

---------------

queryIdentities.queryIdentityWithID

used to query the list of all identities pertaining to a certain ID argument passed. Defines a message and initiates the transaction.

Function Signature

queryIdentityWithID: (id: any) => Promise<any>;


transaction / assets

APIs pertaining to manipulating the 'assets', a DID based entity used to represent NFTs.

burnAsset.burn

used to burn an Asset. Defines a message and initiates the transaction.

Function Signature

burn: (address: string, chain_id: string, mnemonic: string, fromID: string, assetID: string, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

burnAsset.createAssetBurnMsg

used to burn an Asset. Only defines and outputs a message object

Function Signature

createAssetBurnMsg: ( address: string, chain_id: string, fromID: string, assetID: string, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

defineAsset.define

used to define the schema of an Asset. Defines a message and initiates the transaction.

Function Signature

define: ( address: string, chain_id: string, mnemonic: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

defineAsset.createAssetDefineMsg

used to define the schema of an Asset. Only defines and outputs a message object

Function Signature

createAssetDefineMsg: ( address: string, chain_id: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

mintAsset.mint

used to mint an asset using the defined schema. Defines a message and initiates the transaction.

Function Signature

mint: ( address: string, chain_id: string, mnemonic: any, toID: any, fromID: string, classificationID: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

mintAsset.createAssetMintMsg

used to mint an asset using the defined schema. Only defines and outputs a message object.

Function Signature

createAssetMintMsg: ( address: string, chain_id: string, toID: any, fromID: string, classificationID: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

mutateAsset.mutate

used to change the mutable properties of an Asset. These specific properties must be already defined as mutable in the schema of asset. Defines a message and initiates the transaction.

Function Signature

mutate: ( address: string, chain_id: string, mnemonic: any, fromID: string, assetID: any, mutableProperties: string, mutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

mutateAsset.createAssetMutateMsg

used to change the mutable properties of an Asset. These specific properties must be already defined as mutable in the schema of asset. Only defines and outputs a message object.

Function Signature

createAssetMutateMsg: ( address: string, chain_id: string, fromID: string, assetID: any, mutableProperties: string, mutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

queryAssets.queryAsset

used to change the mutable properties of an Asset. These specific properties must be already defined as mutable in the schema of asset. Defines a message and initiates the transaction.

Function Signature

queryAsset: () => Promise<any>;

---------------

queryAssets.queryAssetWithID

used to change the mutable properties of an Asset. These specific properties must be already defined as mutable in the schema of asset. Only defines and outputs a message object.

Function Signature

queryAssetWithID: (id: any) => Promise<any>;


transaction / classification

APIs pertaining to manipulating the Classifications or schemas of entities created

cls.queryClassification

used to query the details of all Classifications IDs.

Function Signature

queryClassification: () => Promise<any>;

---------------

cls.queryClassificationWithID

used to query the details of Classification IDs pertaining to the ID argument provided in the function

Function Signature

queryClassificationWithID: (id: any) => Promise<any>;

---------------


transaction / maintainer

APIs pertaining to managing the maintainers and access control lists of various entities

deputizeMaintainer.deputize

used to provide or revoke access controls to new maintainer roles. Defines a message and initiates the transaction.

Function Signature

deputize: ( address: string, chain_id: string, mnemonic: string, identityID: string, clsID: string, toID: string, maintainedTraits: string, addMaintainer: any, removeMaintainer: any, mutateMaintainer: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

deputizeMaintainer.createDeputizeMsg

used to provide or revoke access controls to new maintainer roles. Only defines and outputs a message object.

Function Signature

createDeputizeMsg: ( address: string, chain_id: string, identityID: string, clsID: string, toID: string, maintainedTraits: string, addMaintainer: any, removeMaintainer: any, mutateMaintainer: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

queryMaintainer.queryMaintainerWithID

used to query the details of Classification IDs pertaining to the ID argument provided in the function

Function Signature

queryMaintainerWithID: (id: any) => Promise<any>;


transaction / order

APIs pertaining to manipulating the 'order', a DID based entity used to represent orders created to perform a transfer of value between 'identities' and 'assets'.

defineOrder.define

used to define a schema for an order type. Defines a message and initiates the transaction.

Function Signature

define: ( address: string, chain_id: string, mnemonic: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

defineOrder.createOrderDefineMsg

used to define a schema for an order type. Only defines and outputs a message object.

Function Signature

createOrderDefineMsg: ( address: string, chain_id: string, fromID: string, mutableTraits: string, immutableTraits: any, mutableMetaTraits: any, immutableMetaTraits: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

makeOrder.make

used to issue an order pertaining to a specific classification. Defines a message and initiates the transaction.

Function Signature

make: ( address: string, chain_id: string, mnemonic: any, fromID: string, classificationID: any, makerOwnableID: string, takerOwnableID: string, expiresIn: any, makerOwnableSplit: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

makeOrder.createOrderMakeMsg

used to issue an order pertaining to a specific classification. Only defines and outputs a message object.

Function Signature

createOrderMakeMsg: ( address: string, chain_id: string, fromID: string, classificationID: any, makerOwnableID: string, takerOwnableID: string, expiresIn: any, makerOwnableSplit: any, mutableProperties: string, immutableProperties: any, mutableMetaProperties: any, immutableMetaProperties: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

takeOrder.take

used to accept an issued order pertaining to a specific order ID. Defines a message and initiates the transaction.

Function Signature

take: ( address: string, chain_id: string, mnemonic: any, fromID: string, takerOwnableSplit: any, orderID: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

takeOrder.createOrderTakeMsg

used to accept an issued order pertaining to a specific order ID. Only defines and outputs a message object.

Function Signature

createOrderTakeMsg: ( address: string, chain_id: string, fromID: string, takerOwnableSplit: any, orderID: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

cancelOrder.cancel

used to cancel an issued order pertaining to a specific order ID. Defines a message and initiates the transaction.

Function Signature

cancel: ( address: string, chain_id: string, mnemonic: string, fromID: string, orderID: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

cancelOrder.createOrderCancelMsg

used to cancel an issued order pertaining to a specific order ID. Only defines and outputs a message object.

Function Signature

createOrderCancelMsg: ( address: string, chain_id: string, fromID: string, orderID: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

queryOrders.queryOrder

used to query for the list of all orders available

Function Signature

queryOrder: () => Promise<any>;

---------------

queryOrders.queryOrderWithID

used to query for a specifc order pertaining to an order ID

Function Signature

queryOrderWithID: (id: any) => Promise<any>;


transaction / meta

APIs pertaining to querying a certain meta property across the entities

queryMeta.queryMetaWithID

used to query for a meta property of entities of a certain ID

Function Signature

queryMetaWithID: (id: any) => Promise<any>;

---------------

revealMeta.reveal

used to cancel an issued order pertaining to a specific order ID. Defines a message and initiates the transaction.

Function Signature

reveal: ( address: string, chain_id: string, mnemonic: any, metaFact: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

revealMeta.createMetaRevealMsg

used to cancel an issued order pertaining to a specific order ID. Only defines and outputs a message object.

Function Signature

createMetaRevealMsg: ( address: string, chain_id: string, metaFact: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;


transaction / splits

APIs pertaining to creating and manipulating fractionalizing of NFTs and their correlation with FTs

querySplits.querySplitsWithID

used to query a split (fractional NFT) using a specific ID

Function Signature

querySplitsWithID: (id: any) => Promise<any>;

---------------

sendSplits.send

used to send a split from one identity to another. Defines a message and initiates the transaction.

Function Signature

send: ( address: string, chain_id: string, mnemonic: string, fromID: string, toID: string, ownableID: string, split: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

sendSplits.createSplitsSendMsg

used to send a split from one identity to another. Only defines and outputs a message object.

Function Signature

createSplitsSendMsg: ( address: string, chain_id: string, fromID: string, toID: string, ownableID: string, split: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

wrapSplits.wrap

used to wrap a coin into a split, which is then used for transacting (transfer of value) in AssetMantle's NFT Economy. Defines a message and initiates the transaction.

Function Signature

wrap: ( address: string, chain_id: string, mnemonic: string, fromID: string, coins: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

wrapSplits.createSplitsWrapMsg

used to wrap a coin into a split, which is then used for transacting (transfer of value) in AssetMantle's NFT Economy. Only defines and outputs a message object.

Function Signature

createSplitsWrapMsg: ( address: string, chain_id: string, fromID: string, coins: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------

unwrapsplits.unwrap

used to unwrap a split back into a coin, which is then used for transacting (transfer of value) in Cosmos Economy and beyond. Defines a message and initiates the transaction.

Function Signature

unwrap: ( address: string, chain_id: string, mnemonic: string, fromID: string, ownableID: string, split: any, feesAmount: any, feesToken: any, gas: any, mode: any, memo: string, ) => Promise<any>;

---------------

unwrapsplits.createSplitsUnwrapMsg

used to unwrap a split back into a coin, which is then used for transacting (transfer of value) in Cosmos Economy and beyond. Only defines and outputs a message object.

Function Signature

createSplitsUnwrapMsg: ( address: string, chain_id: string, fromID: string, ownableID: string, split: any, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------


transaction / accounts

APIs pertaining to creating an account in AssetMantle chain for storing and transacting on coins

createAccount.create

used to create and initiate an account in the AssetMantle chain

Function Signature

create: ( address: string, chain_id: string, mnemonic: string, name: string, denom: string, amount: any, gas: any, memo: string, ) => Promise<any>;

---------------

recoverAccount.recover

used to recover an existing account using a mnemonic

Function Signature

recover: (mnemonic: string, name: string) => Promise<any>;


transaction / bank

APIs pertaining to transfer of value of coins in the AssetMantle chain and beyond.

bank.sendCoin

APIs pertaining to transfer of value of coins in the AssetMantle chain and beyond.

Function Signature

create: ( address: string, chain_id: string, mnemonic: string, name: string, denom: string, amount: any, gas: any, memo: string, ) => Promise<any>;

---------------

bank.createSendCoinMsg

APIs pertaining to transfer of value of coins in the AssetMantle chain and beyond. Only defines and outputs a message object.

Function Signature

createSendCoinMsg: ( from_address: string, chain_id: string, to_address: string, denom: string, amount: string, feesAmount: any, feesToken: any, gas: any, memo: string, ) => Promise<any>;

---------------


utilities / keys

APIs pertaining to creation of wallets and keystores in the AssetMantle chain.

createWallet

used to create a wallet using a mnemonic and a bip39 passphrase.

Function Signature

createWallet: ( mnemonic: string, bip39Passphrase: string, ) => Promise<{ address: string; mnemonic: string; }>;

---------------

createRandomWallet

used to create a wallet using a bip39 passphrase, while the mnemonic is generated automatically.

Function Signature

createRandomWallet: (bip39Passphrase: string) => Promise<{ address: string; mnemonic: string; }>;

---------------

getWallet

used to get the object pertaining to already created wallet, pertaining to a certain mnemonic and bip39 passphrase

Function Signature

getWallet: (mnemonic: string, bip39Passphrase: string) => Promise<any>;

---------------

createStore

used to create a encrypted keystore using a specified mnemonic and password

Function Signature

createStore: ( mnemonic: string, password: string, ) => { Response: any; error: any; };

---------------

decryptStore

used to decrypt / open and encrypted keystore file, by specifying the file path and a password to decrypt.

Function Signature

decryptStore: ( fileData: any, password: string, ) => { mnemonic: any; };

---------------


About

A Javascript Based client for AssetMantle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 71.5%
  • TypeScript 28.5%