amp-wallet
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -32,1 +32,12 @@ import { AccountResponse } from 'stellar-sdk'; | ||
export declare function sendPayment(senderWallet: SimpleAccountObj, receiver: string, amount: number, asset?: string, issuerAccount?: string, memo?: string, validateWallet?: boolean): Promise<any>; | ||
/** | ||
* load 1000 friend bot to wallet if it's native balance is below 100 | ||
* @param {string} pub get public key | ||
* @return {Axios} return axios response | ||
*/ | ||
export declare function loadFriendBot(pub: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
/** | ||
* create new wallet and load 1000 native gas | ||
*@param {string} disctpub disturber secret key to load 1000 native gas into the account | ||
*/ | ||
export declare function createWallet(disctpub: string): Promise<void>; |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendPayment = exports.getWallet = exports.isWalletExists = exports.getAllAccountBalances = void 0; | ||
exports.createWallet = exports.loadFriendBot = exports.sendPayment = exports.getWallet = exports.isWalletExists = exports.getAllAccountBalances = void 0; | ||
var payment_1 = require("./interface/payment"); | ||
@@ -151,1 +151,46 @@ var wallet_1 = require("./wallet"); | ||
exports.sendPayment = sendPayment; | ||
/** | ||
* load 1000 friend bot to wallet if it's native balance is below 100 | ||
* @param {string} pub get public key | ||
* @return {Axios} return axios response | ||
*/ | ||
function loadFriendBot(pub) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_4; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, wallet_1.friendbot)(pub)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_4 = _a.sent(); | ||
throw e_4; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.loadFriendBot = loadFriendBot; | ||
/** | ||
* create new wallet and load 1000 native gas | ||
*@param {string} disctpub disturber secret key to load 1000 native gas into the account | ||
*/ | ||
function createWallet(disctpub) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_5; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, (0, wallet_1.createAccount)(disctpub)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_5 = _a.sent(); | ||
throw e_5; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.createWallet = createWallet; |
export declare function config(): { | ||
horizon_url: string; | ||
networkPassphrase: string; | ||
friendbot: string; | ||
}; |
@@ -7,5 +7,6 @@ "use strict"; | ||
horizon_url: 'https://chain.amanatpay.com', | ||
networkPassphrase: 'Standalone Network ; February 2017 ; ebd4136c0113b9e044326f0b6250ef33a51d0235625f2acf07cc599b87a1664c' | ||
networkPassphrase: 'Standalone Network ; February 2017 ; ebd4136c0113b9e044326f0b6250ef33a51d0235625f2acf07cc599b87a1664c', | ||
friendbot: 'https://friendbot.server.amanatpay.com/' | ||
}; | ||
} | ||
exports.config = config; |
@@ -25,1 +25,6 @@ import { AccountResponse } from 'stellar-sdk'; | ||
export declare function createAccount(distSecret: string): Promise<void>; | ||
/** | ||
* load gas from friend bot | ||
* @param {string} pub public key for any wallet | ||
*/ | ||
export declare function friendbot(pub: string): Promise<import("axios").AxiosResponse<any, any>>; |
@@ -57,4 +57,8 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createAccount = exports.createPair = exports.getAllBalances = exports.getWalletObj = void 0; | ||
exports.friendbot = exports.createAccount = exports.createPair = exports.getAllBalances = exports.getWalletObj = void 0; | ||
var axios_1 = __importDefault(require("axios")); | ||
var stellar_sdk_1 = __importStar(require("stellar-sdk")); | ||
@@ -87,3 +91,2 @@ var setting_1 = require("./setting"); | ||
exports.getWalletObj = getWalletObj; | ||
//---------get all wallet balances and assets --------- | ||
/** | ||
@@ -154,1 +157,23 @@ * return array of wallet's balances of different assets | ||
exports.createAccount = createAccount; | ||
/** | ||
* load gas from friend bot | ||
* @param {string} pub public key for any wallet | ||
*/ | ||
function friendbot(pub) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var e_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, axios_1.default.get("".concat((0, setting_1.config)().friendbot, "?wallet=").concat(pub))]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
e_2 = _a.sent(); | ||
throw e_2; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.friendbot = friendbot; |
{ | ||
"name": "amp-wallet", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "Amanatpay Blockchain Wallet", | ||
@@ -51,4 +51,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"axios": "^0.24.0", | ||
"jsdoc": "^3.6.7" | ||
} | ||
} |
@@ -16,2 +16,6 @@ [![Codecov Coverage](https://img.shields.io/codecov/c/github/caki0915/my-awesome-greeter/coverage.svg?style=flat-square)](https://codecov.io/gh/caki0915/my-awesome-greeter/) | ||
<dd><p>Description: send payment through Amanatpay blockchain network, using multiple assets.</p></dd> | ||
<dt><a href="#loadFriendBot">loadFriendBot(pub)</a> ⇒ <code>Axios</code></dt> | ||
<dd><p>load 1000 friend bot to wallet if it's native balance is below 100</p></dd> | ||
<dt><a href="#createWallet">createWallet(disctpub)</a></dt> | ||
<dd><p>create new wallet and load 1000 native gas</p></dd> | ||
<dt><a href="#getWalletObj">getWalletObj(publicKey)</a> ⇒ <code>AccountResponse</code></dt> | ||
@@ -21,2 +25,8 @@ <dd><p>get wallet's object from Amanatpay blockchain</p></dd> | ||
<dd><p>return array of wallet's balances of different assets</p></dd> | ||
<dt><a href="#createPair">createPair()</a> ⇒ <code>SimpleAccountObj</code></dt> | ||
<dd><p>Create a key pair for creating account</p></dd> | ||
<dt><a href="#createAccount">createAccount(distSecret)</a></dt> | ||
<dd><p>creat account</p></dd> | ||
<dt><a href="#friendbot">friendbot(pub)</a></dt> | ||
<dd><p>load gas from friend bot</p></dd> | ||
</dl> | ||
@@ -76,2 +86,25 @@ | ||
<a name="loadFriendBot"></a> | ||
## loadFriendBot(pub) ⇒ <code>Axios</code> | ||
<p>load 1000 friend bot to wallet if it's native balance is below 100</p> | ||
**Kind**: global function | ||
**Returns**: <code>Axios</code> - <p>return axios response</p> | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| pub | <code>string</code> | <p>get public key</p> | | ||
<a name="createWallet"></a> | ||
## createWallet(disctpub) | ||
<p>create new wallet and load 1000 native gas</p> | ||
**Kind**: global function | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| disctpub | <code>string</code> | <p>disturber secret key to load 1000 native gas into the account</p> | | ||
<a name="getWalletObj"></a> | ||
@@ -101,1 +134,29 @@ | ||
<a name="createPair"></a> | ||
## createPair() ⇒ <code>SimpleAccountObj</code> | ||
<p>Create a key pair for creating account</p> | ||
**Kind**: global function | ||
<a name="createAccount"></a> | ||
## createAccount(distSecret) | ||
<p>creat account</p> | ||
**Kind**: global function | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| distSecret | <code>string</code> | <p>disturber account secret key</p> | | ||
<a name="friendbot"></a> | ||
## friendbot(pub) | ||
<p>load gas from friend bot</p> | ||
**Kind**: global function | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| pub | <code>string</code> | <p>public key for any wallet</p> | | ||
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
33654
563
159
2
+ Addedaxios@^0.24.0
+ Addedaxios@0.24.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)