@gearbox-protocol/sdk 8.1.1 → 8.1.2
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.
|
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var AccountOpener_exports = {};
|
|
20
20
|
__export(AccountOpener_exports, {
|
|
21
|
-
AccountOpener: () => AccountOpener
|
|
21
|
+
AccountOpener: () => AccountOpener,
|
|
22
|
+
OpenTxRevertedError: () => OpenTxRevertedError
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(AccountOpener_exports);
|
|
24
25
|
var import_viem = require("viem");
|
|
@@ -28,6 +29,13 @@ var import_v300 = require("../abi/v300.js");
|
|
|
28
29
|
var import_sdk = require("../sdk/index.js");
|
|
29
30
|
var import_abi = require("./abi.js");
|
|
30
31
|
var import_createAnvilClient = require("./createAnvilClient.js");
|
|
32
|
+
class OpenTxRevertedError extends import_viem.BaseError {
|
|
33
|
+
txHash;
|
|
34
|
+
constructor(txHash) {
|
|
35
|
+
super("open credit account tx reverted");
|
|
36
|
+
this.txHash = txHash;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
31
39
|
class AccountOpener extends import_sdk.SDKConstruct {
|
|
32
40
|
#service;
|
|
33
41
|
#anvil;
|
|
@@ -95,7 +103,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
95
103
|
} catch (e) {
|
|
96
104
|
results.push({
|
|
97
105
|
input: target,
|
|
98
|
-
error:
|
|
106
|
+
error: e
|
|
99
107
|
});
|
|
100
108
|
}
|
|
101
109
|
}
|
|
@@ -123,7 +131,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
123
131
|
} catch (e) {
|
|
124
132
|
return {
|
|
125
133
|
input,
|
|
126
|
-
error:
|
|
134
|
+
error: e,
|
|
127
135
|
rawTx: tx
|
|
128
136
|
};
|
|
129
137
|
}
|
|
@@ -131,7 +139,7 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
131
139
|
if (receipt.status === "reverted") {
|
|
132
140
|
return {
|
|
133
141
|
input,
|
|
134
|
-
error:
|
|
142
|
+
error: new OpenTxRevertedError(hash),
|
|
135
143
|
txHash: hash,
|
|
136
144
|
rawTx: tx
|
|
137
145
|
};
|
|
@@ -590,5 +598,6 @@ class AccountOpener extends import_sdk.SDKConstruct {
|
|
|
590
598
|
}
|
|
591
599
|
// Annotate the CommonJS export names for ESM import in node:
|
|
592
600
|
0 && (module.exports = {
|
|
593
|
-
AccountOpener
|
|
601
|
+
AccountOpener,
|
|
602
|
+
OpenTxRevertedError
|
|
594
603
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAddress, parseEther, parseEventLogs } from "viem";
|
|
1
|
+
import { BaseError, isAddress, parseEther, parseEventLogs } from "viem";
|
|
2
2
|
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
3
3
|
import { ierc20Abi } from "../abi/iERC20.js";
|
|
4
4
|
import { iCreditFacadeV300Abi, iPoolV300Abi } from "../abi/v300.js";
|
|
@@ -14,6 +14,13 @@ import {
|
|
|
14
14
|
} from "../sdk/index.js";
|
|
15
15
|
import { iDegenNftv2Abi } from "./abi.js";
|
|
16
16
|
import { createAnvilClient } from "./createAnvilClient.js";
|
|
17
|
+
class OpenTxRevertedError extends BaseError {
|
|
18
|
+
txHash;
|
|
19
|
+
constructor(txHash) {
|
|
20
|
+
super("open credit account tx reverted");
|
|
21
|
+
this.txHash = txHash;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
class AccountOpener extends SDKConstruct {
|
|
18
25
|
#service;
|
|
19
26
|
#anvil;
|
|
@@ -81,7 +88,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
81
88
|
} catch (e) {
|
|
82
89
|
results.push({
|
|
83
90
|
input: target,
|
|
84
|
-
error:
|
|
91
|
+
error: e
|
|
85
92
|
});
|
|
86
93
|
}
|
|
87
94
|
}
|
|
@@ -109,7 +116,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
109
116
|
} catch (e) {
|
|
110
117
|
return {
|
|
111
118
|
input,
|
|
112
|
-
error:
|
|
119
|
+
error: e,
|
|
113
120
|
rawTx: tx
|
|
114
121
|
};
|
|
115
122
|
}
|
|
@@ -117,7 +124,7 @@ class AccountOpener extends SDKConstruct {
|
|
|
117
124
|
if (receipt.status === "reverted") {
|
|
118
125
|
return {
|
|
119
126
|
input,
|
|
120
|
-
error:
|
|
127
|
+
error: new OpenTxRevertedError(hash),
|
|
121
128
|
txHash: hash,
|
|
122
129
|
rawTx: tx
|
|
123
130
|
};
|
|
@@ -575,5 +582,6 @@ class AccountOpener extends SDKConstruct {
|
|
|
575
582
|
}
|
|
576
583
|
}
|
|
577
584
|
export {
|
|
578
|
-
AccountOpener
|
|
585
|
+
AccountOpener,
|
|
586
|
+
OpenTxRevertedError
|
|
579
587
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { Address, PrivateKeyAccount } from "viem";
|
|
1
|
+
import type { Address, Hash, PrivateKeyAccount } from "viem";
|
|
2
|
+
import { BaseError } from "viem";
|
|
2
3
|
import type { CreditAccountData, CreditAccountsService, RawTx } from "../sdk/index.js";
|
|
3
4
|
import { SDKConstruct } from "../sdk/index.js";
|
|
5
|
+
export declare class OpenTxRevertedError extends BaseError {
|
|
6
|
+
readonly txHash: Hash;
|
|
7
|
+
constructor(txHash: Hash);
|
|
8
|
+
}
|
|
4
9
|
export interface AccountOpenerOptions {
|
|
5
10
|
faucet?: Address;
|
|
6
11
|
borrower?: PrivateKeyAccount;
|
|
@@ -25,7 +30,7 @@ export interface TargetAccount {
|
|
|
25
30
|
}
|
|
26
31
|
export interface OpenAccountResult {
|
|
27
32
|
input: TargetAccount;
|
|
28
|
-
error?:
|
|
33
|
+
error?: Error;
|
|
29
34
|
txHash?: string;
|
|
30
35
|
rawTx?: RawTx;
|
|
31
36
|
account?: CreditAccountData;
|