@dripfi/drip-sdk 1.2.14 → 1.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/DripApi.js
CHANGED
@@ -535,7 +535,7 @@ class DripApi {
|
|
535
535
|
headers: reqHeaders,
|
536
536
|
});
|
537
537
|
const data = yield res.json();
|
538
|
-
return res.ok ? new AuthenticationStatus_1.ValidStatus(data.address) : new AuthenticationStatus_1.ErrorStatus(data.error);
|
538
|
+
return res.ok ? new AuthenticationStatus_1.ValidStatus(data.address, token) : new AuthenticationStatus_1.ErrorStatus(data.error);
|
539
539
|
}
|
540
540
|
catch (error) {
|
541
541
|
console.log(error);
|
package/dist/DripSdk.d.ts
CHANGED
@@ -67,6 +67,7 @@ export default class DripSdk {
|
|
67
67
|
getDripTokenContractAddress(): string;
|
68
68
|
getSwapPerqForBeansInfo(): Promise<PerqToBeansSwapInfo>;
|
69
69
|
transferErc20Token(tokenAddress: string, amount: string, receiver: string): Promise<string>;
|
70
|
+
wrapEther(amount: string, tokenAddress: string): Promise<string>;
|
70
71
|
getVestingStart(): Promise<string>;
|
71
72
|
getVestingEnd(): Promise<string>;
|
72
73
|
getVestedAmount(beneficiary: string): Promise<string>;
|
package/dist/DripSdk.js
CHANGED
@@ -24,6 +24,7 @@ const DripSwapAndRecyclerContract_1 = __importDefault(require("./contracts/DripS
|
|
24
24
|
const PerqVestingContract_1 = __importDefault(require("./contracts/PerqVestingContract"));
|
25
25
|
const utils_1 = require("ethers/lib/utils");
|
26
26
|
const AuthenticationStatus_1 = require("./types/AuthenticationStatus");
|
27
|
+
const WethTokenAbi_json_1 = __importDefault(require("./contracts/abi/WethTokenAbi.json"));
|
27
28
|
class DripSdk {
|
28
29
|
constructor(chain, signer, dripRoute) {
|
29
30
|
this.signer = signer;
|
@@ -537,6 +538,19 @@ class DripSdk {
|
|
537
538
|
return receipt.transactionHash;
|
538
539
|
});
|
539
540
|
}
|
541
|
+
wrapEther(amount, tokenAddress) {
|
542
|
+
return __awaiter(this, void 0, void 0, function* () {
|
543
|
+
if (!this.signer) {
|
544
|
+
throw Error('No signer provided');
|
545
|
+
}
|
546
|
+
const wethContract = new ethers_1.ethers.Contract(tokenAddress, WethTokenAbi_json_1.default, this.signer);
|
547
|
+
const decimals = yield wethContract.decimals();
|
548
|
+
const amountWithDecimals = ethers_1.ethers.utils.parseUnits(amount, decimals);
|
549
|
+
const depositTx = yield wethContract.deposit({ value: amountWithDecimals });
|
550
|
+
const receipt = yield depositTx.wait();
|
551
|
+
return receipt.transactionHash;
|
552
|
+
});
|
553
|
+
}
|
540
554
|
getVestingStart() {
|
541
555
|
return __awaiter(this, void 0, void 0, function* () {
|
542
556
|
try {
|
@@ -0,0 +1 @@
|
|
1
|
+
[{ "constant": true, "inputs": [], "name": "name", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "guy", "type": "address" }, { "name": "wad", "type": "uint256" }], "name": "approve", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "src", "type": "address" }, { "name": "dst", "type": "address" }, { "name": "wad", "type": "uint256" }], "name": "transferFrom", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [{ "name": "wad", "type": "uint256" }], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [{ "name": "", "type": "uint8" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }], "name": "balanceOf", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [{ "name": "", "type": "string" }], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [{ "name": "dst", "type": "address" }, { "name": "wad", "type": "uint256" }], "name": "transfer", "outputs": [{ "name": "", "type": "bool" }], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "deposit", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [{ "name": "", "type": "address" }, { "name": "", "type": "address" }], "name": "allowance", "outputs": [{ "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "src", "type": "address" }, { "indexed": true, "name": "guy", "type": "address" }, { "indexed": false, "name": "wad", "type": "uint256" }], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "src", "type": "address" }, { "indexed": true, "name": "dst", "type": "address" }, { "indexed": false, "name": "wad", "type": "uint256" }], "name": "Transfer", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "dst", "type": "address" }, { "indexed": false, "name": "wad", "type": "uint256" }], "name": "Deposit", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "name": "src", "type": "address" }, { "indexed": false, "name": "wad", "type": "uint256" }], "name": "Withdrawal", "type": "event" }]
|
@@ -8,7 +8,8 @@ export declare class ValidStatus implements AuthenticationStatus {
|
|
8
8
|
message: string;
|
9
9
|
isAuthenticated: boolean;
|
10
10
|
address: string;
|
11
|
-
|
11
|
+
token: string;
|
12
|
+
constructor(address: string, token: string);
|
12
13
|
}
|
13
14
|
export declare class ErrorStatus implements AuthenticationStatus {
|
14
15
|
message: string;
|
@@ -2,10 +2,11 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ErrorStatus = exports.ValidStatus = void 0;
|
4
4
|
class ValidStatus {
|
5
|
-
constructor(address) {
|
5
|
+
constructor(address, token) {
|
6
6
|
this.message = 'Valid Token';
|
7
7
|
this.isAuthenticated = true;
|
8
8
|
this.address = address;
|
9
|
+
this.token = token;
|
9
10
|
}
|
10
11
|
}
|
11
12
|
exports.ValidStatus = ValidStatus;
|