@steerprotocol/sdk 4.0.0-next.5 → 4.0.0-next.6

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/README.md CHANGED
@@ -176,6 +176,13 @@ equivalent is `steer.getDeployment(chainId).getVaults(addresses, options)`.
176
176
 
177
177
  ## Bulk vault accounting snapshots
178
178
 
179
+ Bulk snapshots include optional `implementation: { address, codeHash, beacon, beaconName }` metadata from the
180
+ registered native reader's verified identity at `blockNumber`. This reuses the implementation hash
181
+ already checked by that reader and adds no RPC calls. Custom bindings without a registered verified
182
+ `implementationCodeHash` omit the metadata. `beaconName` reuses the indexed descriptive name from
183
+ the vault metadata, not onchain identity evidence. It does not assert fee-event completeness.
184
+
185
+
179
186
  ```ts
180
187
  const supported: boolean = steer.getDeployment(chainId).supportsVaultSnapshots(beaconName);
181
188
  ```
package/dist/index.cjs CHANGED
@@ -13194,6 +13194,7 @@ function captureVaultSnapshot(snapshot) {
13194
13194
  return Object.freeze({
13195
13195
  ...snapshot,
13196
13196
  pool: capturePool(snapshot.pool),
13197
+ ...snapshot.implementation ? { implementation: Object.freeze({ ...snapshot.implementation }) } : {},
13197
13198
  positions: Object.freeze(snapshot.positions.map((position) => Object.freeze({
13198
13199
  ...position,
13199
13200
  pool: capturePool(position.pool),
@@ -14638,6 +14639,7 @@ const baseAerodromeVaultMappings = /* @__PURE__ */ (() => Object.freeze(aerodrom
14638
14639
  beaconNames: Object.freeze([identity.name]),
14639
14640
  beaconAddress: identity.beacon,
14640
14641
  implementationAddress: identity.implementation,
14642
+ implementationCodeHash: identity.implementationCodeHash,
14641
14643
  kind: "liquidity",
14642
14644
  async readUnderlying(context) {
14643
14645
  const { pool, factory } = await readAerodromePool(context, identity);
@@ -15836,6 +15838,7 @@ const baseIntegralVaultBinding = /* @__PURE__ */ (() => Object.freeze({
15836
15838
  beaconNames: baseIntegralVaultDiscovery.beaconNames,
15837
15839
  beaconAddress: baseIntegralVaultIdentity.beacon,
15838
15840
  implementationAddress: baseIntegralVaultIdentity.implementation,
15841
+ implementationCodeHash: baseIntegralVaultIdentity.implementationCodeHash,
15839
15842
  kind: "liquidity",
15840
15843
  async readUnderlying(context) {
15841
15844
  const { pool, factory } = await readIntegralVaultPool(context);
@@ -15863,7 +15866,8 @@ const polygonIntegralVaultBinding = /* @__PURE__ */ (() => Object.freeze({
15863
15866
  ...baseIntegralVaultBinding,
15864
15867
  beaconNames: polygonIntegralVaultDiscovery.beaconNames,
15865
15868
  beaconAddress: polygonIntegralVaultIdentity.beacon,
15866
- implementationAddress: polygonIntegralVaultIdentity.implementation
15869
+ implementationAddress: polygonIntegralVaultIdentity.implementation,
15870
+ implementationCodeHash: polygonIntegralVaultIdentity.implementationCodeHash
15867
15871
  }))();
15868
15872
  const polygonIntegralVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
15869
15873
  kind: "liquidity",
@@ -17549,6 +17553,7 @@ const baseV3VaultResolver = /* @__PURE__ */ (() => Object.freeze({
17549
17553
  beaconNames: baseV3VaultDiscovery.beaconNames,
17550
17554
  beaconAddress: baseV3VaultIdentity.beacon,
17551
17555
  implementationAddress: baseV3VaultIdentity.implementation,
17556
+ implementationCodeHash: baseV3VaultIdentity.implementationCodeHash,
17552
17557
  kind: "liquidity",
17553
17558
  readUnderlying,
17554
17559
  readSnapshot: readV3VaultAccounting,
@@ -17569,6 +17574,7 @@ const polygonV3VaultBinding = /* @__PURE__ */ (() => Object.freeze({
17569
17574
  beaconNames: polygonV3VaultDiscovery.beaconNames,
17570
17575
  beaconAddress: polygonV3VaultIdentity.beacon,
17571
17576
  implementationAddress: polygonV3VaultIdentity.implementation,
17577
+ implementationCodeHash: polygonV3VaultIdentity.implementationCodeHash,
17572
17578
  kind: "liquidity",
17573
17579
  readUnderlying,
17574
17580
  readSnapshot: readV3VaultAccounting,
@@ -17589,7 +17595,8 @@ const polygonSushiVaultBinding = /* @__PURE__ */ (() => Object.freeze({
17589
17595
  readUnderlying: (context) => readUnderlyingForFactory(context, sushiswapV3Polygon.definition.contracts.factory.address),
17590
17596
  beaconNames: polygonSushiVaultDiscovery.beaconNames,
17591
17597
  beaconAddress: polygonSushiVaultIdentity.beacon,
17592
- implementationAddress: polygonSushiVaultIdentity.implementation
17598
+ implementationAddress: polygonSushiVaultIdentity.implementation,
17599
+ implementationCodeHash: polygonSushiVaultIdentity.implementationCodeHash
17593
17600
  }))();
17594
17601
  const polygonRetroVaultDiscovery = /* @__PURE__ */ (() => Object.freeze({
17595
17602
  amm: retroV3Polygon,
@@ -17600,7 +17607,8 @@ const polygonRetroVaultBinding = /* @__PURE__ */ (() => Object.freeze({
17600
17607
  readUnderlying: (context) => readUnderlyingForFactory(context, retroV3Polygon.definition.contracts.factory.address),
17601
17608
  beaconNames: polygonRetroVaultDiscovery.beaconNames,
17602
17609
  beaconAddress: polygonRetroVaultIdentity.beacon,
17603
- implementationAddress: polygonRetroVaultIdentity.implementation
17610
+ implementationAddress: polygonRetroVaultIdentity.implementation,
17611
+ implementationCodeHash: polygonRetroVaultIdentity.implementationCodeHash
17604
17612
  }))();
17605
17613
  const polygonSushiVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
17606
17614
  ...polygonV3VaultProtocol,
@@ -19049,6 +19057,7 @@ const bscV4VaultBinding = /* @__PURE__ */ (() => Object.freeze({
19049
19057
  beaconNames: bscV4VaultDiscovery.beaconNames,
19050
19058
  beaconAddress: bscV4VaultIdentity.beacon,
19051
19059
  implementationAddress: bscV4VaultIdentity.implementation,
19060
+ implementationCodeHash: bscV4VaultIdentity.implementationCodeHash,
19052
19061
  kind: "liquidity",
19053
19062
  async readUnderlying(context) {
19054
19063
  const pool = await readV4VaultPool(context);
@@ -20465,6 +20474,7 @@ const polygonLegacyVaultBinding = /* @__PURE__ */ (() => Object.freeze({
20465
20474
  beaconNames: polygonLegacyVaultDiscovery.beaconNames,
20466
20475
  beaconAddress: polygonLegacyVaultIdentity.beacon,
20467
20476
  implementationAddress: polygonLegacyVaultIdentity.implementation,
20477
+ implementationCodeHash: polygonLegacyVaultIdentity.implementationCodeHash,
20468
20478
  kind: "liquidity",
20469
20479
  async readUnderlying(context) {
20470
20480
  const { pool, factory } = await readLegacyVaultPool(context);
@@ -20487,7 +20497,8 @@ const polygonLegacyVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
20487
20497
  const historicalPolygonLegacyVaultBinding = /* @__PURE__ */ (() => Object.freeze({
20488
20498
  ...polygonLegacyVaultBinding,
20489
20499
  beaconAddress: historicalPolygonLegacyVaultIdentity.beacon,
20490
- implementationAddress: historicalPolygonLegacyVaultIdentity.implementation
20500
+ implementationAddress: historicalPolygonLegacyVaultIdentity.implementation,
20501
+ implementationCodeHash: historicalPolygonLegacyVaultIdentity.implementationCodeHash
20491
20502
  }))();
20492
20503
  //#endregion
20493
20504
  //#region src/vault/adapters/algebra-legacy/reader/batch-artifact.ts
@@ -20977,6 +20988,18 @@ var VaultResolver = class {
20977
20988
  if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
20978
20989
  return readValidatedVaultSnapshot(vault, snapshot, vault.steer.context);
20979
20990
  }
20991
+ #snapshotImplementation(snapshot, binding, beaconName) {
20992
+ const { implementation: _implementation, ...accounting } = snapshot;
20993
+ return Object.freeze({
20994
+ ...accounting,
20995
+ ...binding.implementationCodeHash ? { implementation: Object.freeze({
20996
+ address: binding.implementationAddress,
20997
+ codeHash: binding.implementationCodeHash,
20998
+ beacon: binding.beaconAddress,
20999
+ beaconName
21000
+ }) } : {}
21001
+ });
21002
+ }
20980
21003
  #metadata(steer, addresses, supplied) {
20981
21004
  let pending;
20982
21005
  return async (address) => {
@@ -21049,9 +21072,9 @@ var VaultResolver = class {
21049
21072
  for (const [i, context] of contexts.entries()) {
21050
21073
  const read = reads[i];
21051
21074
  if (!read) throw new Error("Missing bulk vault snapshot");
21052
- const { vault } = await this.#createVault(context, read.identity, () => loadMetadata(context.address), read);
21075
+ const { vault, binding } = await this.#createVault(context, read.identity, () => loadMetadata(context.address), read);
21053
21076
  if (vault.kind !== "liquidity") throw new VaultResolutionError("invalid-vault", "Vault does not support liquidity snapshots");
21054
- result.push(await read.readSnapshot(vault));
21077
+ result.push(this.#snapshotImplementation(await read.readSnapshot(vault), binding, vault.metadata.beaconName));
21055
21078
  }
21056
21079
  } else {
21057
21080
  bulkSupported = false;
@@ -21067,7 +21090,7 @@ var VaultResolver = class {
21067
21090
  if (!binding.readSnapshot) throw new VaultResolutionError("not-configured", "No verified snapshot reader configured for vault implementation");
21068
21091
  const snapshot = await binding.readSnapshot(resolved);
21069
21092
  if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
21070
- return readValidatedVaultSnapshot(vault, snapshot, steer.context);
21093
+ return this.#snapshotImplementation(await readValidatedVaultSnapshot(vault, snapshot, steer.context), binding, vault.metadata.beaconName);
21071
21094
  })));
21072
21095
  }
21073
21096
  }