ledgefarmcore
v1.1.191
Published
SDK to interact with ledgefarm system
Downloads
24
Readme
Ledgefarmcore
Installation
ledgefarmcore is available on npm. To install it,type:
npm install ledgefarmcore --save
npm install ledgefarmcore package inside your project.And after that package get install your application so that you can interact with the wakandi network.
Usage
For setting up the configuration for the whole application for wallet to get interact with wakandi network.
You can connect to the wakandi network using the sdk
// javascript
const ledgefarmcore = require("ledgefarmcore");
const config = ledgefarmcore.configurationInstance.setConfigurationValue("Url","Access Key",ApiKey,"Cert Path","CertPassphrase");
//typescript
import { configurationInstance } from "ledgefarmcore";
const config = ledgefarmcore.configurationInstance.setConfigurationValue("Url","Access Key","ApiKey","Cert Path","CertPassphrase");
The settings are used to make the application interact with Wakandi core.
WakandiApiUrl: It is the hosted URL of the Wakandi Core API. This URL should end with a version of the application i.e. http://host:port/api/[version]. As of now, current version is v1.
AccessKey: Access key is provided at the time when Wakandi Core is setup. Operator must pass admin access key in the configuration. This key can be used later for further admin related operations. Here, Admin means Operator admin who is the owner of operator.
ApiKey: This is the unique key for each operator that is validating the identity of the operator on each request.
CertPath: : Pass p12 certificate file path in this parameter. You may have got this certificate at the time of operator setup.
CertPassphrase: In this, you have to pass p12 certificate passphrase.
// javascript
const ledgefarmcore = require("ledgefarmcore");
const config = ledgefarmcore.setConfigurationValue("https://ledgefarmapiurl","KD4xxxxxxxxxxxxxasa78s","65sadaxxxxxxxxxxxxxxsad785d",/Users/xxxxxxx,H7Sxxxxxxxx);
// typescript
import { configurationInstance } from 'ledgefarmcore';
configurationInstance.setConfigurationValue("https://ledgefarmapiurl","KD4xxxxxxxxxxxxxasa78s","65sadaxxxxxxxxxxxxxxsad785d",/Users/xxxxxxx,H7Sxxxxxxxx);
Wallet Service
Usage
Wallet service is used to perform all operations related to the wallet like creating wallet, blocking and unblocking a wallet, update wallet information and search wallet,obtain wallet data etc.
- Create Wallet
This function is used to create a wallet. You need to pass a username of the wallet (Walletname) that needs to be created and some basic information about the user to available that wallet for other operator. In response, the packageit will return the wallet address and access Key for that wallet. This access Key will be used for further operations using this wallet.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
let request = {
walletName: "abc",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
isPublic: true
};
await walletService.create(request);
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let request = {
walletName: "abc",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
isPublic: true
};
let walletService = new WalletService("AdminAccessKey");
let wallet: Wallet = await walletService.create(request);
Example
//Request
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("xxxxxxxxxxxxxxxxxxxxxx");
//if you want to create public wallet
let request = {
walletName: "abc",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
isPublic: true
};
await walletService.create(request);
//if you want to create private wallet
let request = {
walletName: "abc"
};
await walletService.create(request);
//typescript
import {WalletService} from 'ledgefarmcore';
import {Wallet} from 'ledgefarmcore';
let walletService = new WalletService("AdminAccessKey");
//if you want to create public wallet
let request: Wallet = {
walletName: "abc",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
isPublic: true
};
let wallet: Wallet = await walletService.create(request);
//if you want to create private wallet
let request: Wallet = {
walletName: "abc"
}
let wallet: Wallet = await walletService.create(request);
- update Wallet
This function is used to update a wallet. The Operator needs to pass a wallet address to update the wallet and information that need to be updated. Admin access key is required for unblocking the wallet.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
let request = {
walletName: "[email protected]",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
blocked: false,
isPublic: true
};
await walletService.update(request);
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let request = {
walletName: "[email protected]",
countryCode: "xx",
phone: "xxxxxxx",
email: "[email protected]",
name: "abc",
blocked: false,
isPublic: true
};
let walletService = new WalletService("xxxxxxxxxxxxxxxxxxxxxx");
let wallet: Wallet = await walletService.update(request);
Example
//Request
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("xxxxxxxxxxxxxxxxxxxxxx");
let request = {
walletName: "[email protected]",
countryCode: "xx",
phone: "12345678",
email: "[email protected]",
name: "abc",
blocked: false
isPublic: true
};
await walletService.update(request);
//typescript
import {WalletService} from 'ledgefarmcore';
import {Wallet} from 'ledgefarmcore';
let walletService = new WalletService("xxxxxxxxxxxxxxxxxxxxxx");
let request: Wallet = {
walletName: "[email protected]",
countryCode: "xx",
phone: "12345678",
email: "[email protected]",
name: "abc",
blocked: false
isPublic: true
};
let wallet: Wallet = await walletService.update(request);
//if you want to convert public wallet into private wallet
let request: Wallet = {
walletName: "[email protected]",
isPublic: false
}
let wallet: Wallet = await walletService.update(request);
- Search Wallet
This function is used to search a wallet. User can search wallet using wallet address, phone number and email. Admin access key is required for searching the wallet in directory service.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
await walletService.searchWallet("searchKey", "countryCode");
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("AdminAccessKey");
let wallet: Wallet = await walletService.searchWallet("searchKey", "countryCode");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
await walletService.searchWallet("[email protected]");
await walletService.searchWallet("xxxxxxx", "xx");
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("AdminAccessKey");
let wallet: Wallet = await walletService.searchWallet("[email protected]");
let wallet: Wallet = await walletService.searchWallet("xxxxxxx" ,"xx");
- Get Wallet
This function is used to obtain the information of a particular wallet by using the wallet name. Admin access key is required to obtain a wallet
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
await walletService.get("walletname");
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("AdminAccessKey");
let wallet: Wallet = await walletService.get("walletname");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("xxxxxxxxxxxxxxxxxxxxxx");
await walletService.get("abc@wallxxxxxxxxx");
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("xxxxxxxxxxxxxxxxxxxxxx");
let wallet: Wallet = await walletService.get("abc@wallxxxxxxxxx");
- Get All Wallet
This function is used to get a list of all the wallets that are registered with the Operator. For this, page size limit and offset need to be passed to get page wise records. Admin access key is required to obtain the list of wallets. Maximum value of limit is 1000 and minimum value is 1 and maximum value of offset can be any positive number and minimum is 1. For example, if you have 30 wallets and page size is 10, then 3 calls will be made with 1,11,21 as the offset and 10 as the page size, in each request.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("AdminAccessKey");
await walletService.getAll("limit","offset");
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("AdminAccessKey");
let wallet: Array<Wallet> = await walletService.getAll("limit","offset");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let walletService = new ledgefarmcore.WalletService("xxxxxxxxxxxxxxxxxxxxxx");
await walletService.getAll(4,1);
//typescript
import { WalletService } from 'ledgefarmcore';
import { Wallet } from 'ledgefarmcore';
let walletService = new WalletService("xxxxxxxxxxxxxxxxxxxxxx");
let wallet: Array<Wallet> = await walletService.getAll(4,1);
Token Service
Usage
Token service is used to perform all the operations related to tokens including issue, transfer, withdraw, and request tokens etc.
- Get token
To get the token which is flowing in the current network.It will provide the total supply(the total token circulation in the particular network).
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("AdminAccessKey");
await tokenService.get("tokenname");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("AdminAccessKey");
let token: Array<Token> = await tokenService.get("tokenname");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
await tokenService.get("USD");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let token: Array<Token> = await tokenService.get("USD");
- Issue token
This function is used to issue tokens to the wallet. The Operator needs to pass the wallet address, token name, amount, transactionId and fee. Here fee parameter is totally depends on operator, operator can choose to apply fee on this transaction. Admin access key is required to issue tokens to a wallet. TransactionId is optional and it is reference id of token received by operator from global network, this needs to be provided in case of global transaction.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("AdminAccessKey");
await tokenService.issue("towalletname","amount","tokenname",null,"transactionId");
//or
await tokenService.issue("towalletname","amount","tokenname","fee");
//or
await tokenService.issue("towalletname","amount","tokenname","fee","transactionId");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("AdminAccessKey");
let token: Token = await tokenService.issue("towalletname","amount","tokenname",null,"transactionId");
//or
let token: Token = await tokenService.issue("towalletname","amount","tokenname","fee");
//or
let token: Token = await tokenService.issue("towalletname","amount","tokenname","fee","transactionId");
Example
//Request :
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",null,"xxxxxxxxxxxxxxxxx");
//or
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxxx”,
“memo”:”Admin Fee on issue of token”,
}]
await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",fee);
//or
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxxx”,
“memo”:”Admin Fee on issue of token”,
}]
await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",fee,"xxxxxxxxxxxxxxxxx");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let token: Token = await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",null,"xxxxxxxxxxxxxxxxx");
//or
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxxx”,
“memo”:”Admin Fee on issue of token”,
}]
let token: Token = await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",fee);
//or
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxxx”,
“memo”:”Admin Fee on issue of token”,
}]
let token: Token = await tokenService.issue("abc@wallxxxxxxxxxx",10,"USD",fee,"xxxxxxxxxxxxxxxxx");
Withdraw token
This function is used to withdraw tokens from the wallet. The Operator needs to pass the wallet address from which the token is withdrawn, token name, amount, and the list of all applicable fees for withdrawing tokens from the user. Admin access key is required to withdraw tokens from the wallet.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("AdminAccessKey");
await tokenService.withdraw("towalletname","amount","tokenname");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("AdminAccessKey");
let token: Token = await tokenService.withdraw("towalletname","amount","tokenname");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxx”,
“memo”:”Admin Fee on withdraw of token”,
}]
await tokenService.withdraw("abc@wallxxxxxxx",10,"USD",fee);
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService(“xxxxxxxxxxxxxxxxxxxxxx”);
let fee = [{
“amount”: 1,
“toWallet”: “cbc@xxxx”,
“memo”:”Admin Fee on withdraw of token”,
}]
let token: Token = await tokenService.withdraw("abc@wallxxxxxxx"10,"USD",fee);
- Transfer token
This function is used to transfer tokens from one wallet to another. The Operator needs to pass wallet address to which the token needs to be transferred, token name, amount, and list of all applicable fees for transferring tokens to the wallet. Here, wallet’s access token (sender) is required to transfer the tokens from wallet.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("UserWalletAccessKey");
await tokenService.transfer("towalletname","amount","tokenname");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("UserWalletAccessKey");
let token: Token = await tokenService.transfer("towalletname","amount","tokenname");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
await tokenService.transfer("abc@wallxxxxxx",10,"USD",fee);
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
let token: Token = await tokenService.transfer("abc@wallxxxxxx",10,"USD",fee);
- Batch Transfer
This function is used to transfer tokens from one wallet to multiple wallet . The Operator needs to pass wallet address to which the token needs to be transferred, token name, amount, and list of all applicable fees for transferring tokens to the wallet. Here, wallet’s access token (sender) is required to transfer the tokens from wallet.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("UserWalletAccessKey");
await tokenService.batchTransfer("amount","token","memo", "batchTransferRequest");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("UserWalletAccessKey");
let token: Token = await tokenService.batchTransfer("amount","token","memo", "batchTransferRequest");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
let batchTransferRequest = [{
“amount”: 1000,
“toWallet”: “abc@oxxxx”,
“memo”:”abc salary ”,
},
{
“amount”: 2000,
“toWallet”: “cbc@oxxxx”,
“memo”:”cbc salary”,
}]
let totalAmount = 1000 + 2000;
await tokenService.batchTransfer(totalAmount,USD,"employee salary",batchTransferRequest,fee);
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
let batchTransferRequest = [{
“amount”: 1000,
“toWallet”: “abc@oxxxx”,
“memo”:”abc salary ”,
},
{
“amount”: 2000,
“toWallet”: “cbc@oxxxx”,
“memo”:”cbc salary”,
}]
let totalAmount = 1000 + 2000;
let token: Token = await tokenService.batchTransfer.batchTransfer(totalAmount,USD,"employee salary",batchTransferRequest,fee);
- Request token
This function is used to request tokens from other wallets. The Operator needs to pass the wallet address from which the token is requested, tokens name, amount, and the list of all applicable fees for requesting tokens. Wallet’s access key (requester) is required for sending requests to other wallets
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("UserWalletAccessKey");
await tokenService.request("fromwalletname","amount","tokenname");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("UserWalletAccessKey");
let token: Token = await tokenService.request("fromwalletname","amount","tokenname");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
await tokenService.request("abc@wallxxxxx",10,"USD");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let token: Token = await tokenService.request("abc@wallxxxxx",10,"USD");
- Accept token Request
This function is used to accept the token request. The Operator needs to pass the token request ID, and the list of all applicable fees for accepting token requests. Wallet’s access key is required for accepting requests from other wallets.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("UserWalletAccessKey");
await tokenService.accept("token request Id",fee);
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("UserWalletAccessKey");
let token: Token = await tokenService.accept("token request Id",fee);
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
await tokenService.accept("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",fee);
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let fee = [{
“amount”: 1,
“toWallet”: “cbc@oxxxx”,
“memo”:”Admin Fee on transfer of token”,
}]
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let token: Token = await tokenService.accept("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",fee);
- Reject token Request
This function is used to reject the token request. The Operator needs to pass the token request ID. Wallet’s access key is required for rejecting requests from other wallets.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("UserWalletAccessKey");
await tokenService.reject("token request Id");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("UserWalletAccessKey");
let token: Token = await tokenService.reject("token request Id");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let tokenService = new ledgefarmcore.TokenService("xxxxxxxxxxxxxxxxxxxxxx");
await tokenService.reject("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//typescript
import { TokenService } from 'ledgefarmcore';
import { Token } from 'ledgefarmcore';
let tokenService = new TokenService("xxxxxxxxxxxxxxxxxxxxxx");
let token: Token = await tokenService.reject("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
Transaction Service
Usage
Transaction service is used to get the information about a specific transaction or list of transactions.
- Get All transactions
This function is used to get the list of all transactions of the Operator. For this, the Operator needs to pass page size limit and offset to get page wise records. Admin access key is required to obtain the list of transactions of the Operator. Maximum value of limit is 1000 and minimum value is 1 and maximum value of offset can be any positive number and minimum is 1. For example if you have 30 records and page size is 10, then 3 calls will be made with 1,11,21 as the offset and 10 as the page size, in each request.
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("AdminAccessKey");
await transactionService.getAll("limit","offset");
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("AdminAccessKey");
let transaction: Array<Transaction> = await transactionService.getAll("limit","offset");
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
await transactionService.getAll(4,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
let transaction: Array<Transaction> = await transactionService.getAll(4,1);
- Get Transaction By Transaction Id
This function is used to get a particular transaction of the Operator. For this, the Operator needs to pass the transaction ID of the particular transaction. Admin access key is required to obtain the transaction of the Operator.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("AdminAccessKey");
await transactionService.get("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",fee);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("AdminAccessKey");
let transaction: Array<Transaction> = await transactionService.get("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",fee);
Example
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
await transactionService.get(4,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
let transaction: Array<Transaction> = await transactionService.get("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",fee;
- Get Transaction By Wallet Name
This function is used to get the list of all transactions related to a particular wallet of the Operator. For this, the Operator needs to pass wallet name, page size limit and offset to get page wise records. Admin access key is required to obtain the list of transactions of the Operator.Maximum value of limit is 1000 and minimum value is 1 and maximum value of offset can be any positive number and minimum is 1. For example if you have 30 records and page size is 10, then 3 calls will me made with 1,11,21 as the offset and 10 as the page size, in each request.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("AdminAccessKey");
await transactionService.getAllByWallet("abc@wallxxxxx",100,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("AdminAccessKey");
let transaction: Array<Transaction> = await transactionService.getAllByWallet("abc@wallxxxxx",100,1);
Example
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
await transactionService.getAllByWallet("abc@wallxxxxx",100,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
let transaction: Array<Transaction> = await transactionService.getAllByWallet("abc@wallxxxx",10,1);
- Get Transaction By Token
This function is used to get the list of all transactions related to a particular token of the Operator. For this, the Operator needs to pass token name, page size limit and offset to get page wise records. Admin access key is required to obtain the list of transactions of the Operator.Maximum value of limit is 1000 and minimum value is 1 and maximum value of offset can be any positive number and minimum is 1. For example if you have 30 records and page size is 10, then 3 calls will me made with 1,11,21 as the offset and 10 as the page size, in each request.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("AdminAccessKey");
await transactionService.getAllByToken("USD",100,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("AdminAccessKey");
let transaction: Array<Transaction> = await transactionService.getAllByToken("USD",100,1);
Example
//javascript
var ledgefarmcore = require("ledgefarmcore");
let transactionService = new ledgefarmcore.TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
await transactionService.getAllByToken("USD",100,1);
//typescript
import { TransactionService } from 'ledgefarmcore';
import { Transaction } from 'ledgefarmcore';
let transactionService = new TransactionService("xxxxxxxxxxxxxxxxxxxxxx");
let transaction: Array<Transaction> = await transactionService.getAllByToken("USD",10,1);
Operator Service
Usage
Operator service is used to get the information about token issued, token owned and operator balance over network.
- Get Token Balance On Global Network
This function is used to get information about total balance over the global network.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new OperatorService("AdminAccessKey");
await operatorService.get();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("AdminAccessKey");
let globalToken: Array<GlobalToken> = await operatorService.get();
Example
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
await operatorService.get();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
let globalToken: Array<GlobalToken> = await operatorService.get();
- Get Issued Token
This function is used to check how many tokens operator issued to other operators on global network.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new ledgefarmcore.OperatorService("AdminAccessKey");
await operatorService.issuedToken();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("AdminAccessKey");
let globalToken: Array<GlobalToken> = await operatorService.issuedToken();
Example
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new ledgefarmcore.OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
await operatorService.issuedToken();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
let globalToken: Array<GlobalToken> = await operatorService.issuedToken();
- Get Owned Token
This function is used to check how many tokens operator owned to other operators on global network.
//Request:
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new ledgefarmcore.OperatorService("AdminAccessKey");
await operatorService.ownedToken();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("AdminAccessKey");
let globalToken: Array<GlobalToken> = await operatorService.ownedToken();
Example
//javascript
var ledgefarmcore = require("ledgefarmcore");
let operatorService = new ledgefarmcore.OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
await operatorService.ownedToken();
//typescript
import { OperatorService } from 'ledgefarmcore';
import { GlobalToken } from 'ledgefarmcore';
let operatorService = new OperatorService("xxxxxxxxxxxxxxxxxxxxxx");
let globalToken: Array<GlobalToken> = await operatorService.ownedToken();