@gearbox-protocol/sdk 18.2.0-next.1 → 18.2.0-next.10

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.
Files changed (81) hide show
  1. package/dist/cjs/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +179 -0
  2. package/dist/cjs/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +534 -0
  3. package/dist/cjs/abi/router/treehouseWorker.js +885 -0
  4. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
  5. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +3 -0
  6. package/dist/cjs/onchain/market/adapters/types.js +3 -0
  7. package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +397 -50
  8. package/dist/cjs/permissionless/api/oracles/enrich.js +99 -0
  9. package/dist/cjs/permissionless/api/oracles/schemas.js +85 -35
  10. package/dist/cjs/permissionless/api/schemas.js +0 -3
  11. package/dist/cjs/permissionless/bindings/index.js +1 -1
  12. package/dist/cjs/permissionless/index.js +2 -1
  13. package/dist/cjs/permissionless/utils/index.js +1 -0
  14. package/dist/cjs/permissionless/utils/price-update/get-prices.js +25 -0
  15. package/dist/cjs/permissionless/utils/price-update/index.js +1 -0
  16. package/dist/cjs/testnets/TestnetsAPI.js +179 -0
  17. package/dist/cjs/testnets/errors/TestnetNotFoundError.js +15 -0
  18. package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +24 -0
  19. package/dist/cjs/testnets/errors/TestnetStatusError.js +19 -0
  20. package/dist/cjs/testnets/errors/TestnetValidationError.js +24 -0
  21. package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +30 -0
  22. package/dist/cjs/testnets/errors/TestnetsError.js +34 -0
  23. package/dist/cjs/testnets/errors/index.js +13 -0
  24. package/dist/cjs/testnets/index.js +32 -0
  25. package/dist/cjs/testnets/package.json +1 -0
  26. package/dist/cjs/testnets/schemas.js +242 -0
  27. package/dist/cjs/testnets/types.js +1 -0
  28. package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +178 -0
  29. package/dist/esm/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +533 -0
  30. package/dist/esm/abi/router/treehouseWorker.js +884 -0
  31. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
  32. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +3 -0
  33. package/dist/esm/onchain/market/adapters/types.js +3 -0
  34. package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +399 -52
  35. package/dist/esm/permissionless/api/oracles/enrich.js +94 -0
  36. package/dist/esm/permissionless/api/oracles/schemas.js +80 -35
  37. package/dist/esm/permissionless/api/schemas.js +2 -4
  38. package/dist/esm/permissionless/bindings/index.js +1 -1
  39. package/dist/esm/permissionless/index.js +3 -3
  40. package/dist/esm/permissionless/utils/index.js +2 -2
  41. package/dist/esm/permissionless/utils/price-update/get-prices.js +25 -1
  42. package/dist/esm/permissionless/utils/price-update/index.js +2 -2
  43. package/dist/esm/testnets/TestnetsAPI.js +178 -0
  44. package/dist/esm/testnets/errors/TestnetNotFoundError.js +14 -0
  45. package/dist/esm/testnets/errors/TestnetRequestFailedError.js +23 -0
  46. package/dist/esm/testnets/errors/TestnetStatusError.js +18 -0
  47. package/dist/esm/testnets/errors/TestnetValidationError.js +23 -0
  48. package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +29 -0
  49. package/dist/esm/testnets/errors/TestnetsError.js +33 -0
  50. package/dist/esm/testnets/errors/index.js +7 -0
  51. package/dist/esm/testnets/index.js +11 -0
  52. package/dist/esm/testnets/package.json +1 -0
  53. package/dist/esm/testnets/schemas.js +228 -0
  54. package/dist/esm/testnets/types.js +1 -0
  55. package/dist/types/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.d.ts +148 -0
  56. package/dist/types/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.d.ts +440 -0
  57. package/dist/types/abi/router/treehouseWorker.d.ts +728 -0
  58. package/dist/types/onchain/market/adapters/types.d.ts +4 -1
  59. package/dist/types/permissionless/api/index.d.ts +2 -2
  60. package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +120 -37
  61. package/dist/types/permissionless/api/oracles/enrich.d.ts +59 -0
  62. package/dist/types/permissionless/api/oracles/index.d.ts +2 -2
  63. package/dist/types/permissionless/api/oracles/schemas.d.ts +164 -24
  64. package/dist/types/permissionless/api/oracles/types.d.ts +350 -63
  65. package/dist/types/permissionless/api/schemas.d.ts +0 -2
  66. package/dist/types/permissionless/index.d.ts +3 -3
  67. package/dist/types/permissionless/utils/index.d.ts +2 -2
  68. package/dist/types/permissionless/utils/price-update/get-prices.d.ts +17 -0
  69. package/dist/types/permissionless/utils/price-update/index.d.ts +2 -2
  70. package/dist/types/testnets/TestnetsAPI.d.ts +108 -0
  71. package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +12 -0
  72. package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +11 -0
  73. package/dist/types/testnets/errors/TestnetStatusError.d.ts +15 -0
  74. package/dist/types/testnets/errors/TestnetValidationError.d.ts +16 -0
  75. package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +21 -0
  76. package/dist/types/testnets/errors/TestnetsError.d.ts +47 -0
  77. package/dist/types/testnets/errors/index.d.ts +7 -0
  78. package/dist/types/testnets/index.d.ts +11 -0
  79. package/dist/types/testnets/schemas.d.ts +554 -0
  80. package/dist/types/testnets/types.d.ts +717 -0
  81. package/package.json +9 -3
@@ -0,0 +1,242 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_onchain_chain_chains = require("../onchain/chain/chains.js");
3
+ const require_onchain_utils_zod = require("../onchain/utils/zod.js");
4
+ let zod_v4 = require("zod/v4");
5
+ //#region src/testnets/schemas.ts
6
+ /**
7
+ * Go marshals a nil slice as `null`; this reads it as an empty array.
8
+ **/
9
+ function nullableArray(item) {
10
+ return zod_v4.z.array(item).nullable().transform((value) => value ?? []);
11
+ }
12
+ /**
13
+ * Go marshals a nil map as `null`; this reads it as an empty record.
14
+ **/
15
+ function nullableRecord(value) {
16
+ return zod_v4.z.record(zod_v4.z.string(), value).nullable().transform((record) => record ?? {});
17
+ }
18
+ const timestamp = zod_v4.z.iso.datetime({ offset: true });
19
+ /**
20
+ * {@link TestnetStageStatus}
21
+ **/
22
+ const testnetStageStatusSchema = zod_v4.z.enum([
23
+ "queued",
24
+ "started",
25
+ "error",
26
+ "failed",
27
+ "success",
28
+ "terminated"
29
+ ]);
30
+ /**
31
+ * {@link TestnetBackendState}
32
+ **/
33
+ const testnetBackendStateSchema = zod_v4.z.enum([
34
+ "provisioning",
35
+ "starting",
36
+ "active",
37
+ "error"
38
+ ]);
39
+ /**
40
+ * {@link Testnet}
41
+ **/
42
+ const testnetSchema = zod_v4.z.object({
43
+ alias: zod_v4.z.string(),
44
+ executionId: zod_v4.z.string(),
45
+ isActive: zod_v4.z.boolean(),
46
+ description: zod_v4.z.string(),
47
+ persistent: zod_v4.z.boolean(),
48
+ paused: zod_v4.z.boolean(),
49
+ network: require_onchain_chain_chains.NetworkType,
50
+ createdAt: timestamp
51
+ });
52
+ /**
53
+ * {@link TestnetBackendOptions}
54
+ **/
55
+ const testnetBackendOptionsSchema = zod_v4.z.object({
56
+ version: zod_v4.z.string().optional(),
57
+ env: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).optional(),
58
+ parentBranchId: zod_v4.z.string().optional()
59
+ });
60
+ /**
61
+ * {@link TestnetBackendStatus}
62
+ **/
63
+ const testnetBackendStatusSchema = zod_v4.z.object({
64
+ state: testnetBackendStateSchema,
65
+ error: zod_v4.z.string().optional(),
66
+ version: zod_v4.z.string().optional()
67
+ });
68
+ /**
69
+ * {@link TestnetBlock}
70
+ **/
71
+ const testnetBlockSchema = zod_v4.z.object({
72
+ number: zod_v4.z.number(),
73
+ time: timestamp
74
+ });
75
+ /**
76
+ * {@link TestnetScriptBlock}
77
+ **/
78
+ const testnetScriptBlockSchema = testnetBlockSchema.extend({
79
+ timeDrift: zod_v4.z.number(),
80
+ originDrift: zod_v4.z.string(),
81
+ automine: zod_v4.z.boolean(),
82
+ mineInterval: zod_v4.z.number()
83
+ });
84
+ /**
85
+ * {@link TestnetScriptOptions}
86
+ **/
87
+ const testnetScriptOptionsSchema = zod_v4.z.object({
88
+ id: zod_v4.z.string(),
89
+ description: zod_v4.z.string(),
90
+ npx: zod_v4.z.string().optional(),
91
+ docker: zod_v4.z.string().optional(),
92
+ args: nullableArray(zod_v4.z.string()),
93
+ env: nullableRecord(zod_v4.z.string()),
94
+ flags: nullableArray(zod_v4.z.string()),
95
+ timeout: zod_v4.z.string(),
96
+ packageManager: zod_v4.z.string().optional(),
97
+ input: zod_v4.z.unknown().optional()
98
+ });
99
+ /**
100
+ * {@link TestnetScript}
101
+ **/
102
+ const testnetScriptSchema = zod_v4.z.object({
103
+ script: testnetScriptOptionsSchema,
104
+ duration: zod_v4.z.string(),
105
+ blockBefore: testnetScriptBlockSchema.optional(),
106
+ blockAfter: testnetScriptBlockSchema.optional(),
107
+ status: testnetStageStatusSchema,
108
+ error: zod_v4.z.string().optional(),
109
+ exitCode: zod_v4.z.number(),
110
+ source: zod_v4.z.string().optional(),
111
+ revision: zod_v4.z.string().optional()
112
+ });
113
+ /**
114
+ * {@link TestnetTaskDefinition}
115
+ **/
116
+ const testnetTaskDefinitionSchema = zod_v4.z.object({
117
+ id: zod_v4.z.string().optional(),
118
+ family: zod_v4.z.string().optional(),
119
+ name: zod_v4.z.string().optional(),
120
+ description: zod_v4.z.string().optional(),
121
+ image: zod_v4.z.string(),
122
+ version: zod_v4.z.string().optional(),
123
+ entrypoint: zod_v4.z.array(zod_v4.z.string()).optional(),
124
+ command: zod_v4.z.array(zod_v4.z.string()).optional(),
125
+ env: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).optional(),
126
+ secrets: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).optional(),
127
+ input: zod_v4.z.unknown().optional(),
128
+ timeout: zod_v4.z.number().optional(),
129
+ concurrent: zod_v4.z.boolean(),
130
+ multicontainer: zod_v4.z.boolean(),
131
+ schemaVersion: zod_v4.z.number().optional()
132
+ });
133
+ /**
134
+ * {@link TestnetTaskProgress}
135
+ **/
136
+ const testnetTaskProgressSchema = zod_v4.z.object({
137
+ completed: zod_v4.z.number(),
138
+ total: zod_v4.z.number(),
139
+ details: zod_v4.z.unknown().optional()
140
+ });
141
+ /**
142
+ * {@link TestnetTask}
143
+ **/
144
+ const testnetTaskSchema = zod_v4.z.object({
145
+ id: zod_v4.z.string(),
146
+ definitionId: zod_v4.z.string(),
147
+ family: zod_v4.z.string(),
148
+ executionId: zod_v4.z.string(),
149
+ name: zod_v4.z.string().optional(),
150
+ description: zod_v4.z.string().optional(),
151
+ image: zod_v4.z.string(),
152
+ source: zod_v4.z.string().optional(),
153
+ revision: zod_v4.z.string().optional(),
154
+ entrypoint: zod_v4.z.array(zod_v4.z.string()).optional(),
155
+ command: zod_v4.z.array(zod_v4.z.string()).optional(),
156
+ env: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).optional(),
157
+ secrets: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).optional(),
158
+ input: zod_v4.z.unknown().optional(),
159
+ multicontainer: zod_v4.z.boolean(),
160
+ concurrent: zod_v4.z.boolean(),
161
+ outputDir: zod_v4.z.string().optional(),
162
+ status: testnetStageStatusSchema,
163
+ error: zod_v4.z.string().optional(),
164
+ createdAt: timestamp,
165
+ updatedAt: timestamp,
166
+ progress: testnetTaskProgressSchema
167
+ });
168
+ /**
169
+ * {@link TestnetOptions}
170
+ **/
171
+ const testnetOptionsSchema = zod_v4.z.object({
172
+ description: zod_v4.z.string().optional(),
173
+ chainId: zod_v4.z.number().optional(),
174
+ network: require_onchain_chain_chains.NetworkType,
175
+ cid: zod_v4.z.string().optional(),
176
+ anvilFlags: zod_v4.z.array(zod_v4.z.string()).optional(),
177
+ anvilImage: zod_v4.z.string().optional(),
178
+ rpcProvider: zod_v4.z.string().optional(),
179
+ addressProvider: require_onchain_utils_zod.ZodAddress().optional(),
180
+ marketConfigurators: zod_v4.z.array(require_onchain_utils_zod.ZodAddress()).optional(),
181
+ rwaFactories: zod_v4.z.array(require_onchain_utils_zod.ZodAddress()).optional(),
182
+ blockNumber: zod_v4.z.string(),
183
+ owner: zod_v4.z.string(),
184
+ timeout: zod_v4.z.string(),
185
+ synctronLogLevel: zod_v4.z.string().optional(),
186
+ scripts: nullableArray(testnetScriptOptionsSchema),
187
+ disableSync: zod_v4.z.boolean(),
188
+ disableIntervalMining: zod_v4.z.boolean(),
189
+ disableRPCProtection: zod_v4.z.boolean(),
190
+ debug: zod_v4.z.boolean().optional(),
191
+ webhooks: nullableArray(zod_v4.z.string()),
192
+ backend: testnetBackendOptionsSchema.optional(),
193
+ tasks: zod_v4.z.array(testnetTaskDefinitionSchema).optional()
194
+ });
195
+ /**
196
+ * {@link TestnetStatus}
197
+ **/
198
+ const testnetStatusSchema = zod_v4.z.object({
199
+ alias: zod_v4.z.string().optional(),
200
+ network: require_onchain_chain_chains.NetworkType,
201
+ nextRestart: timestamp.optional(),
202
+ isActive: zod_v4.z.boolean(),
203
+ ready: zod_v4.z.boolean(),
204
+ paused: zod_v4.z.boolean(),
205
+ rpcUrl: zod_v4.z.string().optional(),
206
+ url: zod_v4.z.string(),
207
+ logsUrl: zod_v4.z.string(),
208
+ persistent: zod_v4.z.boolean(),
209
+ latestBlock: testnetScriptBlockSchema.optional(),
210
+ tasks: zod_v4.z.array(testnetTaskSchema).optional(),
211
+ backend: testnetBackendStatusSchema.optional(),
212
+ executionId: zod_v4.z.string(),
213
+ options: testnetOptionsSchema,
214
+ forkBlock: testnetBlockSchema,
215
+ syncBlock: zod_v4.z.number(),
216
+ syncError: zod_v4.z.string().optional(),
217
+ originChainId: zod_v4.z.number(),
218
+ anvilChainId: zod_v4.z.number(),
219
+ createdAt: timestamp,
220
+ addressProvider: require_onchain_utils_zod.ZodAddress(),
221
+ marketConfigurators: zod_v4.z.array(require_onchain_utils_zod.ZodAddress()).optional(),
222
+ rwaFactories: zod_v4.z.array(require_onchain_utils_zod.ZodAddress()).optional(),
223
+ onchainExecutionId: require_onchain_utils_zod.ZodAddress(),
224
+ scripts: zod_v4.z.array(testnetScriptSchema).optional(),
225
+ cid: zod_v4.z.string().optional(),
226
+ files: zod_v4.z.array(zod_v4.z.string()).optional()
227
+ });
228
+ //#endregion
229
+ exports.testnetBackendOptionsSchema = testnetBackendOptionsSchema;
230
+ exports.testnetBackendStateSchema = testnetBackendStateSchema;
231
+ exports.testnetBackendStatusSchema = testnetBackendStatusSchema;
232
+ exports.testnetBlockSchema = testnetBlockSchema;
233
+ exports.testnetOptionsSchema = testnetOptionsSchema;
234
+ exports.testnetSchema = testnetSchema;
235
+ exports.testnetScriptBlockSchema = testnetScriptBlockSchema;
236
+ exports.testnetScriptOptionsSchema = testnetScriptOptionsSchema;
237
+ exports.testnetScriptSchema = testnetScriptSchema;
238
+ exports.testnetStageStatusSchema = testnetStageStatusSchema;
239
+ exports.testnetStatusSchema = testnetStatusSchema;
240
+ exports.testnetTaskDefinitionSchema = testnetTaskDefinitionSchema;
241
+ exports.testnetTaskProgressSchema = testnetTaskProgressSchema;
242
+ exports.testnetTaskSchema = testnetTaskSchema;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
@@ -0,0 +1,178 @@
1
+ //#region src/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.ts
2
+ const treehouseLiquidationSubcompressorAbi = [
3
+ {
4
+ type: "function",
5
+ name: "contractType",
6
+ inputs: [],
7
+ outputs: [{
8
+ name: "",
9
+ type: "bytes32",
10
+ internalType: "bytes32"
11
+ }],
12
+ stateMutability: "view"
13
+ },
14
+ {
15
+ type: "function",
16
+ name: "getLiquidationData",
17
+ inputs: [
18
+ {
19
+ name: "liquidator",
20
+ type: "address",
21
+ internalType: "address"
22
+ },
23
+ {
24
+ name: "creditAccount",
25
+ type: "address",
26
+ internalType: "address"
27
+ },
28
+ {
29
+ name: "phantomToken",
30
+ type: "address",
31
+ internalType: "address"
32
+ },
33
+ {
34
+ name: "priceUpdates",
35
+ type: "tuple[]",
36
+ internalType: "struct PriceUpdate[]",
37
+ components: [{
38
+ name: "priceFeed",
39
+ type: "address",
40
+ internalType: "address"
41
+ }, {
42
+ name: "data",
43
+ type: "bytes",
44
+ internalType: "bytes"
45
+ }]
46
+ }
47
+ ],
48
+ outputs: [{
49
+ name: "data",
50
+ type: "tuple",
51
+ internalType: "struct LiquidationData",
52
+ components: [
53
+ {
54
+ name: "requiredToken",
55
+ type: "address",
56
+ internalType: "address"
57
+ },
58
+ {
59
+ name: "requiredAmount",
60
+ type: "uint256",
61
+ internalType: "uint256"
62
+ },
63
+ {
64
+ name: "expectedOutputs",
65
+ type: "tuple[]",
66
+ internalType: "struct LiquidationOutput[]",
67
+ components: [
68
+ {
69
+ name: "token",
70
+ type: "address",
71
+ internalType: "address"
72
+ },
73
+ {
74
+ name: "amount",
75
+ type: "uint256",
76
+ internalType: "uint256"
77
+ },
78
+ {
79
+ name: "delayed",
80
+ type: "bool",
81
+ internalType: "bool"
82
+ },
83
+ {
84
+ name: "redeemerAddress",
85
+ type: "address",
86
+ internalType: "address"
87
+ },
88
+ {
89
+ name: "claimableAt",
90
+ type: "uint256",
91
+ internalType: "uint256"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ name: "liquidationCall",
97
+ type: "tuple",
98
+ internalType: "struct MultiCall",
99
+ components: [{
100
+ name: "target",
101
+ type: "address",
102
+ internalType: "address"
103
+ }, {
104
+ name: "callData",
105
+ type: "bytes",
106
+ internalType: "bytes"
107
+ }]
108
+ },
109
+ {
110
+ name: "isLiquidatorEligible",
111
+ type: "bool",
112
+ internalType: "bool"
113
+ },
114
+ {
115
+ name: "isCreditAccountFrozen",
116
+ type: "bool",
117
+ internalType: "bool"
118
+ },
119
+ {
120
+ name: "kycProtocol",
121
+ type: "string",
122
+ internalType: "string"
123
+ },
124
+ {
125
+ name: "kycToken",
126
+ type: "address",
127
+ internalType: "address"
128
+ }
129
+ ]
130
+ }],
131
+ stateMutability: "nonpayable"
132
+ },
133
+ {
134
+ type: "function",
135
+ name: "getRWALiquidatorInfo",
136
+ inputs: [{
137
+ name: "token",
138
+ type: "address",
139
+ internalType: "address"
140
+ }],
141
+ outputs: [{
142
+ name: "info",
143
+ type: "tuple",
144
+ internalType: "struct RWALiquidatorInfo",
145
+ components: [
146
+ {
147
+ name: "gateway",
148
+ type: "address",
149
+ internalType: "address"
150
+ },
151
+ {
152
+ name: "liquidatorAddress",
153
+ type: "address",
154
+ internalType: "address"
155
+ },
156
+ {
157
+ name: "contractType",
158
+ type: "bytes32",
159
+ internalType: "bytes32"
160
+ }
161
+ ]
162
+ }],
163
+ stateMutability: "view"
164
+ },
165
+ {
166
+ type: "function",
167
+ name: "version",
168
+ inputs: [],
169
+ outputs: [{
170
+ name: "",
171
+ type: "uint256",
172
+ internalType: "uint256"
173
+ }],
174
+ stateMutability: "view"
175
+ }
176
+ ];
177
+ //#endregion
178
+ export { treehouseLiquidationSubcompressorAbi };