@gearbox-protocol/sdk 18.5.0-next.3 → 18.5.0

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 (78) hide show
  1. package/dist/cjs/onchain/abi/index.js +0 -2
  2. package/dist/cjs/onchain/abi/oracles.js +0 -617
  3. package/dist/cjs/onchain/index.js +0 -4
  4. package/dist/cjs/onchain/market/index.js +0 -4
  5. package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +0 -4
  6. package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +0 -4
  7. package/dist/cjs/onchain/market/pricefeeds/index.js +0 -4
  8. package/dist/cjs/permissionless/bindings/price-feed-store.js +0 -1
  9. package/dist/cjs/permissionless/bindings/pricefeeds/index.js +3 -7
  10. package/dist/cjs/sdk/execute/ExecuteApi.js +41 -0
  11. package/dist/cjs/testnets/TestnetsAPI.js +178 -0
  12. package/dist/cjs/testnets/errors/TestnetNotFoundError.js +14 -0
  13. package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +23 -0
  14. package/dist/cjs/testnets/errors/TestnetStatusError.js +18 -0
  15. package/dist/cjs/testnets/errors/TestnetValidationError.js +23 -0
  16. package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +29 -0
  17. package/dist/cjs/testnets/errors/TestnetsError.js +33 -0
  18. package/dist/cjs/testnets/errors/index.js +13 -0
  19. package/dist/cjs/testnets/index.js +32 -0
  20. package/dist/cjs/testnets/package.json +1 -0
  21. package/dist/cjs/testnets/schemas.js +241 -0
  22. package/dist/cjs/testnets/types.js +1 -0
  23. package/dist/esm/onchain/abi/index.js +1 -1
  24. package/dist/esm/onchain/abi/oracles.js +1 -616
  25. package/dist/esm/onchain/index.js +1 -3
  26. package/dist/esm/onchain/market/index.js +1 -3
  27. package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +0 -4
  28. package/dist/esm/onchain/market/pricefeeds/feeds/index.js +1 -3
  29. package/dist/esm/onchain/market/pricefeeds/index.js +1 -3
  30. package/dist/esm/permissionless/bindings/price-feed-store.js +0 -1
  31. package/dist/esm/permissionless/bindings/pricefeeds/index.js +3 -7
  32. package/dist/esm/sdk/execute/ExecuteApi.js +41 -0
  33. package/dist/esm/testnets/TestnetsAPI.js +177 -0
  34. package/dist/esm/testnets/errors/TestnetNotFoundError.js +13 -0
  35. package/dist/esm/testnets/errors/TestnetRequestFailedError.js +22 -0
  36. package/dist/esm/testnets/errors/TestnetStatusError.js +17 -0
  37. package/dist/esm/testnets/errors/TestnetValidationError.js +22 -0
  38. package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +28 -0
  39. package/dist/esm/testnets/errors/TestnetsError.js +32 -0
  40. package/dist/esm/testnets/errors/index.js +7 -0
  41. package/dist/esm/testnets/index.js +11 -0
  42. package/dist/esm/testnets/package.json +1 -0
  43. package/dist/esm/testnets/schemas.js +227 -0
  44. package/dist/esm/testnets/types.js +1 -0
  45. package/dist/types/onchain/abi/index.d.ts +2 -2
  46. package/dist/types/onchain/abi/oracles.d.ts +0 -536
  47. package/dist/types/onchain/index.d.ts +1 -3
  48. package/dist/types/onchain/market/index.d.ts +1 -3
  49. package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +1 -3
  50. package/dist/types/onchain/market/pricefeeds/index.d.ts +1 -3
  51. package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -1
  52. package/dist/types/permissionless/core/pricefeed-builder.d.ts +0 -2
  53. package/dist/types/sdk/execute/ExecuteApi.d.ts +8 -0
  54. package/dist/types/sdk/execute/types.d.ts +14 -0
  55. package/dist/types/testnets/TestnetsAPI.d.ts +106 -0
  56. package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +10 -0
  57. package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +9 -0
  58. package/dist/types/testnets/errors/TestnetStatusError.d.ts +13 -0
  59. package/dist/types/testnets/errors/TestnetValidationError.d.ts +14 -0
  60. package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +19 -0
  61. package/dist/types/testnets/errors/TestnetsError.d.ts +45 -0
  62. package/dist/types/testnets/errors/index.d.ts +7 -0
  63. package/dist/types/testnets/index.d.ts +17 -0
  64. package/dist/types/testnets/schemas.d.ts +552 -0
  65. package/dist/types/testnets/types.d.ts +715 -0
  66. package/package.json +6 -1
  67. package/dist/cjs/onchain/market/pricefeeds/feeds/FixedRateWindowPriceFeed.js +0 -15
  68. package/dist/cjs/onchain/market/pricefeeds/feeds/MedianPriceFeed.js +0 -15
  69. package/dist/cjs/permissionless/bindings/pricefeeds/fix-rate-window.js +0 -53
  70. package/dist/cjs/permissionless/bindings/pricefeeds/median.js +0 -22
  71. package/dist/esm/onchain/market/pricefeeds/feeds/FixedRateWindowPriceFeed.js +0 -14
  72. package/dist/esm/onchain/market/pricefeeds/feeds/MedianPriceFeed.js +0 -14
  73. package/dist/esm/permissionless/bindings/pricefeeds/fix-rate-window.js +0 -52
  74. package/dist/esm/permissionless/bindings/pricefeeds/median.js +0 -21
  75. package/dist/types/onchain/market/pricefeeds/feeds/FixedRateWindowPriceFeed.d.ts +0 -9
  76. package/dist/types/onchain/market/pricefeeds/feeds/MedianPriceFeed.d.ts +0 -9
  77. package/dist/types/permissionless/bindings/pricefeeds/fix-rate-window.d.ts +0 -3
  78. package/dist/types/permissionless/bindings/pricefeeds/median.d.ts +0 -3
@@ -0,0 +1,227 @@
1
+ import { NetworkType } from "../onchain/chain/chains.js";
2
+ import { ZodAddress } from "../onchain/utils/zod.js";
3
+ import { z } from "zod/v4";
4
+ // src/testnets/schemas.ts
5
+ /**
6
+ * Go marshals a nil slice as `null`; this reads it as an empty array.
7
+ **/
8
+ function nullableArray(item) {
9
+ return z.array(item).nullable().transform((value) => value ?? []);
10
+ }
11
+ /**
12
+ * Go marshals a nil map as `null`; this reads it as an empty record.
13
+ **/
14
+ function nullableRecord(value) {
15
+ return z.record(z.string(), value).nullable().transform((record) => record ?? {});
16
+ }
17
+ const timestamp = z.iso.datetime({ offset: true });
18
+ /**
19
+ * {@link TestnetStageStatus}
20
+ **/
21
+ const testnetStageStatusSchema = z.enum([
22
+ "queued",
23
+ "started",
24
+ "error",
25
+ "failed",
26
+ "success",
27
+ "terminated"
28
+ ]);
29
+ /**
30
+ * {@link TestnetBackendState}
31
+ **/
32
+ const testnetBackendStateSchema = z.enum([
33
+ "provisioning",
34
+ "starting",
35
+ "active",
36
+ "error"
37
+ ]);
38
+ /**
39
+ * {@link Testnet}
40
+ **/
41
+ const testnetSchema = z.object({
42
+ alias: z.string(),
43
+ executionId: z.string(),
44
+ isActive: z.boolean(),
45
+ description: z.string(),
46
+ persistent: z.boolean(),
47
+ paused: z.boolean(),
48
+ network: NetworkType,
49
+ createdAt: timestamp
50
+ });
51
+ /**
52
+ * {@link TestnetBackendOptions}
53
+ **/
54
+ const testnetBackendOptionsSchema = z.object({
55
+ version: z.string().optional(),
56
+ env: z.record(z.string(), z.string()).optional(),
57
+ parentBranchId: z.string().optional()
58
+ });
59
+ /**
60
+ * {@link TestnetBackendStatus}
61
+ **/
62
+ const testnetBackendStatusSchema = z.object({
63
+ state: testnetBackendStateSchema,
64
+ error: z.string().optional(),
65
+ version: z.string().optional()
66
+ });
67
+ /**
68
+ * {@link TestnetBlock}
69
+ **/
70
+ const testnetBlockSchema = z.object({
71
+ number: z.number(),
72
+ time: timestamp
73
+ });
74
+ /**
75
+ * {@link TestnetScriptBlock}
76
+ **/
77
+ const testnetScriptBlockSchema = testnetBlockSchema.extend({
78
+ timeDrift: z.number(),
79
+ originDrift: z.string(),
80
+ automine: z.boolean(),
81
+ mineInterval: z.number()
82
+ });
83
+ /**
84
+ * {@link TestnetScriptOptions}
85
+ **/
86
+ const testnetScriptOptionsSchema = z.object({
87
+ id: z.string(),
88
+ description: z.string(),
89
+ npx: z.string().optional(),
90
+ docker: z.string().optional(),
91
+ args: nullableArray(z.string()),
92
+ env: nullableRecord(z.string()),
93
+ flags: nullableArray(z.string()),
94
+ timeout: z.string(),
95
+ packageManager: z.string().optional(),
96
+ input: z.unknown().optional()
97
+ });
98
+ /**
99
+ * {@link TestnetScript}
100
+ **/
101
+ const testnetScriptSchema = z.object({
102
+ script: testnetScriptOptionsSchema,
103
+ duration: z.string(),
104
+ blockBefore: testnetScriptBlockSchema.optional(),
105
+ blockAfter: testnetScriptBlockSchema.optional(),
106
+ status: testnetStageStatusSchema,
107
+ error: z.string().optional(),
108
+ exitCode: z.number(),
109
+ source: z.string().optional(),
110
+ revision: z.string().optional()
111
+ });
112
+ /**
113
+ * {@link TestnetTaskDefinition}
114
+ **/
115
+ const testnetTaskDefinitionSchema = z.object({
116
+ id: z.string().optional(),
117
+ family: z.string().optional(),
118
+ name: z.string().optional(),
119
+ description: z.string().optional(),
120
+ image: z.string(),
121
+ version: z.string().optional(),
122
+ entrypoint: z.array(z.string()).optional(),
123
+ command: z.array(z.string()).optional(),
124
+ env: z.record(z.string(), z.string()).optional(),
125
+ secrets: z.record(z.string(), z.string()).optional(),
126
+ input: z.unknown().optional(),
127
+ timeout: z.number().optional(),
128
+ concurrent: z.boolean(),
129
+ multicontainer: z.boolean(),
130
+ schemaVersion: z.number().optional()
131
+ });
132
+ /**
133
+ * {@link TestnetTaskProgress}
134
+ **/
135
+ const testnetTaskProgressSchema = z.object({
136
+ completed: z.number(),
137
+ total: z.number(),
138
+ details: z.unknown().optional()
139
+ });
140
+ /**
141
+ * {@link TestnetTask}
142
+ **/
143
+ const testnetTaskSchema = z.object({
144
+ id: z.string(),
145
+ definitionId: z.string(),
146
+ family: z.string(),
147
+ executionId: z.string(),
148
+ name: z.string().optional(),
149
+ description: z.string().optional(),
150
+ image: z.string(),
151
+ source: z.string().optional(),
152
+ revision: z.string().optional(),
153
+ entrypoint: z.array(z.string()).optional(),
154
+ command: z.array(z.string()).optional(),
155
+ env: z.record(z.string(), z.string()).optional(),
156
+ secrets: z.record(z.string(), z.string()).optional(),
157
+ input: z.unknown().optional(),
158
+ multicontainer: z.boolean(),
159
+ concurrent: z.boolean(),
160
+ outputDir: z.string().optional(),
161
+ status: testnetStageStatusSchema,
162
+ error: z.string().optional(),
163
+ createdAt: timestamp,
164
+ updatedAt: timestamp,
165
+ progress: testnetTaskProgressSchema
166
+ });
167
+ /**
168
+ * {@link TestnetOptions}
169
+ **/
170
+ const testnetOptionsSchema = z.object({
171
+ description: z.string().optional(),
172
+ chainId: z.number().optional(),
173
+ network: NetworkType,
174
+ cid: z.string().optional(),
175
+ anvilFlags: z.array(z.string()).optional(),
176
+ anvilImage: z.string().optional(),
177
+ rpcProvider: z.string().optional(),
178
+ addressProvider: ZodAddress().optional(),
179
+ marketConfigurators: z.array(ZodAddress()).optional(),
180
+ rwaFactories: z.array(ZodAddress()).optional(),
181
+ blockNumber: z.string(),
182
+ owner: z.string(),
183
+ timeout: z.string(),
184
+ synctronLogLevel: z.string().optional(),
185
+ scripts: nullableArray(testnetScriptOptionsSchema),
186
+ disableSync: z.boolean(),
187
+ disableIntervalMining: z.boolean(),
188
+ disableRPCProtection: z.boolean(),
189
+ debug: z.boolean().optional(),
190
+ webhooks: nullableArray(z.string()),
191
+ backend: testnetBackendOptionsSchema.optional(),
192
+ tasks: z.array(testnetTaskDefinitionSchema).optional()
193
+ });
194
+ /**
195
+ * {@link TestnetStatus}
196
+ **/
197
+ const testnetStatusSchema = z.object({
198
+ alias: z.string().optional(),
199
+ network: NetworkType,
200
+ nextRestart: timestamp.optional(),
201
+ isActive: z.boolean(),
202
+ ready: z.boolean(),
203
+ paused: z.boolean(),
204
+ rpcUrl: z.string().optional(),
205
+ url: z.string(),
206
+ logsUrl: z.string(),
207
+ persistent: z.boolean(),
208
+ latestBlock: testnetScriptBlockSchema.optional(),
209
+ tasks: z.array(testnetTaskSchema).optional(),
210
+ backend: testnetBackendStatusSchema.optional(),
211
+ executionId: z.string(),
212
+ options: testnetOptionsSchema,
213
+ forkBlock: testnetBlockSchema,
214
+ syncBlock: z.number(),
215
+ syncError: z.string().optional(),
216
+ originChainId: z.number(),
217
+ anvilChainId: z.number(),
218
+ createdAt: timestamp,
219
+ addressProvider: ZodAddress(),
220
+ marketConfigurators: z.array(ZodAddress()).optional(),
221
+ rwaFactories: z.array(ZodAddress()).optional(),
222
+ onchainExecutionId: ZodAddress(),
223
+ scripts: z.array(testnetScriptSchema).optional(),
224
+ cid: z.string().optional(),
225
+ files: z.array(z.string()).optional()
226
+ });
227
+ export { testnetBackendOptionsSchema, testnetBackendStateSchema, testnetBackendStatusSchema, testnetBlockSchema, testnetOptionsSchema, testnetSchema, testnetScriptBlockSchema, testnetScriptOptionsSchema, testnetScriptSchema, testnetStageStatusSchema, testnetStatusSchema, testnetTaskDefinitionSchema, testnetTaskProgressSchema, testnetTaskSchema };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- import { boundedPriceFeedAbi, bptStablePriceFeedAbi, bptWeightedPriceFeedAbi, chainlinkReadableAggregatorAbi, compositePriceFeedAbi, constantPriceFeedAbi, curveCryptoLpPriceFeedAbi, curveStableLpPriceFeedAbi, curveUsdPriceFeedAbi, erc4626PriceFeedAbi, fixedRateWindowPriceFeedAbi, iBalancerStablePoolAbi, iBalancerWeightedPoolAbi, iCurvePoolAbi, iMellowVaultAbi, iRedstonePriceFeedEventsAbi, ilpPriceFeedAbi, ilpPriceFeedEventsAbi, iwstEthAbi, iyVaultAbi, medianPriceFeedAbi, mellowLrtPriceFeedAbi, pendleTWAPPTPriceFeedAbi, pythPriceFeedAbi, redstonePriceFeedAbi, wstEthPriceFeedAbi, yearnPriceFeedAbi, zeroPriceFeedAbi } from "./oracles.js";
2
- export { boundedPriceFeedAbi, bptStablePriceFeedAbi, bptWeightedPriceFeedAbi, chainlinkReadableAggregatorAbi, compositePriceFeedAbi, constantPriceFeedAbi, curveCryptoLpPriceFeedAbi, curveStableLpPriceFeedAbi, curveUsdPriceFeedAbi, erc4626PriceFeedAbi, fixedRateWindowPriceFeedAbi, iBalancerStablePoolAbi, iBalancerWeightedPoolAbi, iCurvePoolAbi, iMellowVaultAbi, iRedstonePriceFeedEventsAbi, ilpPriceFeedAbi, ilpPriceFeedEventsAbi, iwstEthAbi, iyVaultAbi, medianPriceFeedAbi, mellowLrtPriceFeedAbi, pendleTWAPPTPriceFeedAbi, pythPriceFeedAbi, redstonePriceFeedAbi, wstEthPriceFeedAbi, yearnPriceFeedAbi, zeroPriceFeedAbi };
1
+ import { boundedPriceFeedAbi, bptStablePriceFeedAbi, bptWeightedPriceFeedAbi, chainlinkReadableAggregatorAbi, compositePriceFeedAbi, constantPriceFeedAbi, curveCryptoLpPriceFeedAbi, curveStableLpPriceFeedAbi, curveUsdPriceFeedAbi, erc4626PriceFeedAbi, iBalancerStablePoolAbi, iBalancerWeightedPoolAbi, iCurvePoolAbi, iMellowVaultAbi, iRedstonePriceFeedEventsAbi, ilpPriceFeedAbi, ilpPriceFeedEventsAbi, iwstEthAbi, iyVaultAbi, mellowLrtPriceFeedAbi, pendleTWAPPTPriceFeedAbi, pythPriceFeedAbi, redstonePriceFeedAbi, wstEthPriceFeedAbi, yearnPriceFeedAbi, zeroPriceFeedAbi } from "./oracles.js";
2
+ export { boundedPriceFeedAbi, bptStablePriceFeedAbi, bptWeightedPriceFeedAbi, chainlinkReadableAggregatorAbi, compositePriceFeedAbi, constantPriceFeedAbi, curveCryptoLpPriceFeedAbi, curveStableLpPriceFeedAbi, curveUsdPriceFeedAbi, erc4626PriceFeedAbi, iBalancerStablePoolAbi, iBalancerWeightedPoolAbi, iCurvePoolAbi, iMellowVaultAbi, iRedstonePriceFeedEventsAbi, ilpPriceFeedAbi, ilpPriceFeedEventsAbi, iwstEthAbi, iyVaultAbi, mellowLrtPriceFeedAbi, pendleTWAPPTPriceFeedAbi, pythPriceFeedAbi, redstonePriceFeedAbi, wstEthPriceFeedAbi, yearnPriceFeedAbi, zeroPriceFeedAbi };