amp-wallet
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -43,1 +43,6 @@ import { AccountResponse } from 'stellar-sdk'; | ||
export declare function createWallet(disctpub: string): Promise<object>; | ||
/** | ||
* Wallet's transactions for all assets | ||
* | ||
*/ | ||
export declare function History(pub: string): Promise<any>; |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createWallet = exports.loadFriendBot = exports.sendPayment = exports.getWallet = exports.isWalletExists = exports.getAllAccountBalances = void 0; | ||
exports.History = exports.createWallet = exports.loadFriendBot = exports.sendPayment = exports.getWallet = exports.isWalletExists = exports.getAllAccountBalances = void 0; | ||
var payment_1 = require("./interface/payment"); | ||
@@ -196,1 +196,23 @@ var wallet_1 = require("./wallet"); | ||
exports.createWallet = createWallet; | ||
/** | ||
* Wallet's transactions for all assets | ||
* | ||
*/ | ||
function History(pub) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_6; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, wallet_1.transactionHistory)(pub)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_6 = _a.sent(); | ||
throw e_6; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.History = History; |
import { AccountResponse } from 'stellar-sdk'; | ||
import { SimpleAccountObj } from './interface/account'; | ||
interface history { | ||
_links: object; | ||
_embedded: records[]; | ||
} | ||
interface links { | ||
self: object; | ||
account: object; | ||
ledger: object; | ||
operations: object; | ||
effects: object; | ||
precedes: object; | ||
succeeds: object; | ||
} | ||
interface records { | ||
memo: string; | ||
_links: links; | ||
id: string; | ||
paging_token: number; | ||
successful: boolean; | ||
hash: string; | ||
ledger: number; | ||
source_account: string; | ||
source_account_sequence: number; | ||
fee_charged: number; | ||
max_fee: number; | ||
operation_count: number; | ||
envelope_xdr: string; | ||
result_xdr: string; | ||
result_meta_xdr: string; | ||
fee_meta_xdr: string; | ||
memo_type: string; | ||
signatures: string[]; | ||
valid_after: string; | ||
valid_before: string; | ||
} | ||
/** | ||
@@ -31,1 +66,13 @@ * get wallet's object from Amanatpay blockchain | ||
export declare function friendbot(pub: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
/** | ||
* Wallet's transactions for all assets | ||
*@param {string} pub wallet public key | ||
*@return {object} list of all wallet's transactions | ||
*/ | ||
export declare function transactionHistory(pub: string): Promise<any>; | ||
/** | ||
* convert raw transactions list ( payment) to needed details | ||
* @param {history} history | ||
*/ | ||
export declare function convertTransactionHistory(history: history): Promise<any[]>; | ||
export {}; |
@@ -61,3 +61,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.friendbot = exports.createAccount = exports.createPair = exports.getAllBalances = exports.getWalletObj = void 0; | ||
exports.convertTransactionHistory = exports.transactionHistory = exports.friendbot = exports.createAccount = exports.createPair = exports.getAllBalances = exports.getWalletObj = void 0; | ||
var axios_1 = __importDefault(require("axios")); | ||
@@ -196,1 +196,62 @@ var stellar_sdk_1 = __importStar(require("stellar-sdk")); | ||
exports.friendbot = friendbot; | ||
/** | ||
* Wallet's transactions for all assets | ||
*@param {string} pub wallet public key | ||
*@return {object} list of all wallet's transactions | ||
*/ | ||
function transactionHistory(pub) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var server, e_4; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
server = new stellar_sdk_1.default.Server((0, setting_1.config)().horizon_url); | ||
return [4 /*yield*/, server | ||
.payments() | ||
.forAccount(pub) | ||
.call() | ||
.then(function (resp) { | ||
return resp; | ||
}) | ||
.catch(function (err) { | ||
throw err; | ||
})]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_4 = _a.sent(); | ||
throw e_4; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.transactionHistory = transactionHistory; | ||
/** | ||
* convert raw transactions list ( payment) to needed details | ||
* @param {history} history | ||
*/ | ||
function convertTransactionHistory(history) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var trxs; | ||
return __generator(this, function (_a) { | ||
trxs = history.records.map(function (elem) { | ||
return { | ||
paging_token: elem.paging_token, | ||
transaction_successful: elem.transaction_successful, | ||
source_account: elem.source_account, | ||
type: elem.type, | ||
type_i: elem.type_i, | ||
created_at: elem.created_at, | ||
transaction_hash: elem.transaction_hash, | ||
asset_type: elem.asset_type, | ||
from: elem.from, | ||
to: elem.to, | ||
amount: elem.amount | ||
}; | ||
}); | ||
return [2 /*return*/, Promise.resolve(trxs)]; | ||
}); | ||
}); | ||
} | ||
exports.convertTransactionHistory = convertTransactionHistory; |
{ | ||
"name": "amp-wallet", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Amanatpay Blockchain Wallet", | ||
@@ -24,3 +24,3 @@ "main": "lib/index.js", | ||
"bugs": { | ||
"url": "" | ||
"url": "amanatpay.com/report/bugs" | ||
}, | ||
@@ -27,0 +27,0 @@ "homepage": "", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
39321
719
0