impermax-sdk 2.1.26 → 2.1.28
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, BigNumber } from "ethers";
|
|
2
|
-
import { Contract, Permits } from "../onchainTypes";
|
|
2
|
+
import { Contract, Permit, Permits } from "../onchainTypes";
|
|
3
3
|
import OnchainInteractions from './index';
|
|
4
4
|
import OnchainPoolToken from '../onchainPoolToken';
|
|
5
5
|
import OnchainAccountPoolToken from '../account/onchainAccountPoolToken';
|
|
@@ -21,6 +21,7 @@ export default abstract class OnchainInteractionsPoolToken {
|
|
|
21
21
|
getPoolTokenAllowance(): Promise<ethers.BigNumber>;
|
|
22
22
|
getUnderlyingAllowance(): Promise<ethers.BigNumber>;
|
|
23
23
|
approvePoolToken(amount: BigNumber, onTransactionHash: Function): Promise<any>;
|
|
24
|
+
permitPoolToken(amount: BigNumber, callBack: (permit: Permit | null) => void): Promise<void>;
|
|
24
25
|
approveUnderlying(amount: BigNumber, onTransactionHash: Function): Promise<any>;
|
|
25
26
|
protected getSendData(permits: Permits): Promise<{
|
|
26
27
|
router: any;
|
|
@@ -79,6 +79,13 @@ class OnchainInteractionsPoolToken {
|
|
|
79
79
|
return this.send(poolToken.methods.approve(spender, amount), onTransactionHash);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
permitPoolToken(amount, callBack) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const { owner, spender } = this.getOwnerSpender();
|
|
85
|
+
const poolToken = yield this.poolToken.getPoolToken();
|
|
86
|
+
this.getPermitHelper().getTokenPermit(poolToken, owner, spender, amount, callBack);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
82
89
|
approveUnderlying(amount, onTransactionHash) {
|
|
83
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
91
|
const { spender } = this.getOwnerSpender();
|
|
@@ -121,6 +121,7 @@ class OnchainPermitHelper {
|
|
|
121
121
|
console.error(err);
|
|
122
122
|
return callBack(null);
|
|
123
123
|
}
|
|
124
|
+
console.log("signature", data.result);
|
|
124
125
|
callBack(data.result);
|
|
125
126
|
});
|
|
126
127
|
});
|
|
@@ -135,6 +136,7 @@ class OnchainPermitHelper {
|
|
|
135
136
|
nonce: ethers_1.BigNumber.from(nonce).toHexString(),
|
|
136
137
|
deadline: this.deadline,
|
|
137
138
|
});
|
|
139
|
+
console.log("jsonData", jsonData);
|
|
138
140
|
this.getSignature(owner, jsonData, (signature) => {
|
|
139
141
|
if (!signature)
|
|
140
142
|
return callBack(null);
|