@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 +7 -0
- package/dist/index.cjs +30 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +30 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -394,6 +394,8 @@ export interface VaultImplementationBinding {
|
|
|
394
394
|
readonly beaconNames?: readonly string[];
|
|
395
395
|
readonly beaconAddress: Address;
|
|
396
396
|
readonly implementationAddress: Address;
|
|
397
|
+
/** Runtime hash checked by this binding's native snapshot reader before returning accounting. */
|
|
398
|
+
readonly implementationCodeHash?: Hex;
|
|
397
399
|
readonly kind: VaultKind;
|
|
398
400
|
readUnderlying(context: VaultReadContext): Promise<readonly UnderlyingReference[]>;
|
|
399
401
|
createVault(context: ResolvedVaultContext): KnownSteerVault;
|
|
@@ -705,6 +707,14 @@ interface LiquidityVaultRewards {
|
|
|
705
707
|
}
|
|
706
708
|
interface LiquidityVaultSnapshot<TPool extends LiquidityPool = LiquidityPool> {
|
|
707
709
|
readonly blockNumber: bigint;
|
|
710
|
+
/** Verified implementation at blockNumber, supplied by registered bulk snapshot readers. */
|
|
711
|
+
readonly implementation?: {
|
|
712
|
+
readonly address: Address;
|
|
713
|
+
readonly codeHash: Hex;
|
|
714
|
+
readonly beacon: Address;
|
|
715
|
+
/** Indexed descriptive name, not onchain identity evidence. */
|
|
716
|
+
readonly beaconName: string;
|
|
717
|
+
};
|
|
708
718
|
readonly pool: TPool;
|
|
709
719
|
readonly token0: Address;
|
|
710
720
|
readonly token1: Address;
|
package/dist/index.d.mts
CHANGED
|
@@ -394,6 +394,8 @@ export interface VaultImplementationBinding {
|
|
|
394
394
|
readonly beaconNames?: readonly string[];
|
|
395
395
|
readonly beaconAddress: Address;
|
|
396
396
|
readonly implementationAddress: Address;
|
|
397
|
+
/** Runtime hash checked by this binding's native snapshot reader before returning accounting. */
|
|
398
|
+
readonly implementationCodeHash?: Hex;
|
|
397
399
|
readonly kind: VaultKind;
|
|
398
400
|
readUnderlying(context: VaultReadContext): Promise<readonly UnderlyingReference[]>;
|
|
399
401
|
createVault(context: ResolvedVaultContext): KnownSteerVault;
|
|
@@ -705,6 +707,14 @@ interface LiquidityVaultRewards {
|
|
|
705
707
|
}
|
|
706
708
|
interface LiquidityVaultSnapshot<TPool extends LiquidityPool = LiquidityPool> {
|
|
707
709
|
readonly blockNumber: bigint;
|
|
710
|
+
/** Verified implementation at blockNumber, supplied by registered bulk snapshot readers. */
|
|
711
|
+
readonly implementation?: {
|
|
712
|
+
readonly address: Address;
|
|
713
|
+
readonly codeHash: Hex;
|
|
714
|
+
readonly beacon: Address;
|
|
715
|
+
/** Indexed descriptive name, not onchain identity evidence. */
|
|
716
|
+
readonly beaconName: string;
|
|
717
|
+
};
|
|
708
718
|
readonly pool: TPool;
|
|
709
719
|
readonly token0: Address;
|
|
710
720
|
readonly token1: Address;
|
package/dist/index.mjs
CHANGED
|
@@ -13193,6 +13193,7 @@ function captureVaultSnapshot(snapshot) {
|
|
|
13193
13193
|
return Object.freeze({
|
|
13194
13194
|
...snapshot,
|
|
13195
13195
|
pool: capturePool(snapshot.pool),
|
|
13196
|
+
...snapshot.implementation ? { implementation: Object.freeze({ ...snapshot.implementation }) } : {},
|
|
13196
13197
|
positions: Object.freeze(snapshot.positions.map((position) => Object.freeze({
|
|
13197
13198
|
...position,
|
|
13198
13199
|
pool: capturePool(position.pool),
|
|
@@ -14637,6 +14638,7 @@ const baseAerodromeVaultMappings = /* @__PURE__ */ (() => Object.freeze(aerodrom
|
|
|
14637
14638
|
beaconNames: Object.freeze([identity.name]),
|
|
14638
14639
|
beaconAddress: identity.beacon,
|
|
14639
14640
|
implementationAddress: identity.implementation,
|
|
14641
|
+
implementationCodeHash: identity.implementationCodeHash,
|
|
14640
14642
|
kind: "liquidity",
|
|
14641
14643
|
async readUnderlying(context) {
|
|
14642
14644
|
const { pool, factory } = await readAerodromePool(context, identity);
|
|
@@ -15835,6 +15837,7 @@ const baseIntegralVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
15835
15837
|
beaconNames: baseIntegralVaultDiscovery.beaconNames,
|
|
15836
15838
|
beaconAddress: baseIntegralVaultIdentity.beacon,
|
|
15837
15839
|
implementationAddress: baseIntegralVaultIdentity.implementation,
|
|
15840
|
+
implementationCodeHash: baseIntegralVaultIdentity.implementationCodeHash,
|
|
15838
15841
|
kind: "liquidity",
|
|
15839
15842
|
async readUnderlying(context) {
|
|
15840
15843
|
const { pool, factory } = await readIntegralVaultPool(context);
|
|
@@ -15862,7 +15865,8 @@ const polygonIntegralVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
15862
15865
|
...baseIntegralVaultBinding,
|
|
15863
15866
|
beaconNames: polygonIntegralVaultDiscovery.beaconNames,
|
|
15864
15867
|
beaconAddress: polygonIntegralVaultIdentity.beacon,
|
|
15865
|
-
implementationAddress: polygonIntegralVaultIdentity.implementation
|
|
15868
|
+
implementationAddress: polygonIntegralVaultIdentity.implementation,
|
|
15869
|
+
implementationCodeHash: polygonIntegralVaultIdentity.implementationCodeHash
|
|
15866
15870
|
}))();
|
|
15867
15871
|
const polygonIntegralVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
|
|
15868
15872
|
kind: "liquidity",
|
|
@@ -17548,6 +17552,7 @@ const baseV3VaultResolver = /* @__PURE__ */ (() => Object.freeze({
|
|
|
17548
17552
|
beaconNames: baseV3VaultDiscovery.beaconNames,
|
|
17549
17553
|
beaconAddress: baseV3VaultIdentity.beacon,
|
|
17550
17554
|
implementationAddress: baseV3VaultIdentity.implementation,
|
|
17555
|
+
implementationCodeHash: baseV3VaultIdentity.implementationCodeHash,
|
|
17551
17556
|
kind: "liquidity",
|
|
17552
17557
|
readUnderlying,
|
|
17553
17558
|
readSnapshot: readV3VaultAccounting,
|
|
@@ -17568,6 +17573,7 @@ const polygonV3VaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
17568
17573
|
beaconNames: polygonV3VaultDiscovery.beaconNames,
|
|
17569
17574
|
beaconAddress: polygonV3VaultIdentity.beacon,
|
|
17570
17575
|
implementationAddress: polygonV3VaultIdentity.implementation,
|
|
17576
|
+
implementationCodeHash: polygonV3VaultIdentity.implementationCodeHash,
|
|
17571
17577
|
kind: "liquidity",
|
|
17572
17578
|
readUnderlying,
|
|
17573
17579
|
readSnapshot: readV3VaultAccounting,
|
|
@@ -17588,7 +17594,8 @@ const polygonSushiVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
17588
17594
|
readUnderlying: (context) => readUnderlyingForFactory(context, sushiswapV3Polygon.definition.contracts.factory.address),
|
|
17589
17595
|
beaconNames: polygonSushiVaultDiscovery.beaconNames,
|
|
17590
17596
|
beaconAddress: polygonSushiVaultIdentity.beacon,
|
|
17591
|
-
implementationAddress: polygonSushiVaultIdentity.implementation
|
|
17597
|
+
implementationAddress: polygonSushiVaultIdentity.implementation,
|
|
17598
|
+
implementationCodeHash: polygonSushiVaultIdentity.implementationCodeHash
|
|
17592
17599
|
}))();
|
|
17593
17600
|
const polygonRetroVaultDiscovery = /* @__PURE__ */ (() => Object.freeze({
|
|
17594
17601
|
amm: retroV3Polygon,
|
|
@@ -17599,7 +17606,8 @@ const polygonRetroVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
17599
17606
|
readUnderlying: (context) => readUnderlyingForFactory(context, retroV3Polygon.definition.contracts.factory.address),
|
|
17600
17607
|
beaconNames: polygonRetroVaultDiscovery.beaconNames,
|
|
17601
17608
|
beaconAddress: polygonRetroVaultIdentity.beacon,
|
|
17602
|
-
implementationAddress: polygonRetroVaultIdentity.implementation
|
|
17609
|
+
implementationAddress: polygonRetroVaultIdentity.implementation,
|
|
17610
|
+
implementationCodeHash: polygonRetroVaultIdentity.implementationCodeHash
|
|
17603
17611
|
}))();
|
|
17604
17612
|
const polygonSushiVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
|
|
17605
17613
|
...polygonV3VaultProtocol,
|
|
@@ -19048,6 +19056,7 @@ const bscV4VaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
19048
19056
|
beaconNames: bscV4VaultDiscovery.beaconNames,
|
|
19049
19057
|
beaconAddress: bscV4VaultIdentity.beacon,
|
|
19050
19058
|
implementationAddress: bscV4VaultIdentity.implementation,
|
|
19059
|
+
implementationCodeHash: bscV4VaultIdentity.implementationCodeHash,
|
|
19051
19060
|
kind: "liquidity",
|
|
19052
19061
|
async readUnderlying(context) {
|
|
19053
19062
|
const pool = await readV4VaultPool(context);
|
|
@@ -20464,6 +20473,7 @@ const polygonLegacyVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
|
20464
20473
|
beaconNames: polygonLegacyVaultDiscovery.beaconNames,
|
|
20465
20474
|
beaconAddress: polygonLegacyVaultIdentity.beacon,
|
|
20466
20475
|
implementationAddress: polygonLegacyVaultIdentity.implementation,
|
|
20476
|
+
implementationCodeHash: polygonLegacyVaultIdentity.implementationCodeHash,
|
|
20467
20477
|
kind: "liquidity",
|
|
20468
20478
|
async readUnderlying(context) {
|
|
20469
20479
|
const { pool, factory } = await readLegacyVaultPool(context);
|
|
@@ -20486,7 +20496,8 @@ const polygonLegacyVaultProtocol = /* @__PURE__ */ (() => Object.freeze({
|
|
|
20486
20496
|
const historicalPolygonLegacyVaultBinding = /* @__PURE__ */ (() => Object.freeze({
|
|
20487
20497
|
...polygonLegacyVaultBinding,
|
|
20488
20498
|
beaconAddress: historicalPolygonLegacyVaultIdentity.beacon,
|
|
20489
|
-
implementationAddress: historicalPolygonLegacyVaultIdentity.implementation
|
|
20499
|
+
implementationAddress: historicalPolygonLegacyVaultIdentity.implementation,
|
|
20500
|
+
implementationCodeHash: historicalPolygonLegacyVaultIdentity.implementationCodeHash
|
|
20490
20501
|
}))();
|
|
20491
20502
|
//#endregion
|
|
20492
20503
|
//#region src/vault/adapters/algebra-legacy/reader/batch-artifact.ts
|
|
@@ -20976,6 +20987,18 @@ var VaultResolver = class {
|
|
|
20976
20987
|
if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
|
|
20977
20988
|
return readValidatedVaultSnapshot(vault, snapshot, vault.steer.context);
|
|
20978
20989
|
}
|
|
20990
|
+
#snapshotImplementation(snapshot, binding, beaconName) {
|
|
20991
|
+
const { implementation: _implementation, ...accounting } = snapshot;
|
|
20992
|
+
return Object.freeze({
|
|
20993
|
+
...accounting,
|
|
20994
|
+
...binding.implementationCodeHash ? { implementation: Object.freeze({
|
|
20995
|
+
address: binding.implementationAddress,
|
|
20996
|
+
codeHash: binding.implementationCodeHash,
|
|
20997
|
+
beacon: binding.beaconAddress,
|
|
20998
|
+
beaconName
|
|
20999
|
+
}) } : {}
|
|
21000
|
+
});
|
|
21001
|
+
}
|
|
20979
21002
|
#metadata(steer, addresses, supplied) {
|
|
20980
21003
|
let pending;
|
|
20981
21004
|
return async (address) => {
|
|
@@ -21048,9 +21071,9 @@ var VaultResolver = class {
|
|
|
21048
21071
|
for (const [i, context] of contexts.entries()) {
|
|
21049
21072
|
const read = reads[i];
|
|
21050
21073
|
if (!read) throw new Error("Missing bulk vault snapshot");
|
|
21051
|
-
const { vault } = await this.#createVault(context, read.identity, () => loadMetadata(context.address), read);
|
|
21074
|
+
const { vault, binding } = await this.#createVault(context, read.identity, () => loadMetadata(context.address), read);
|
|
21052
21075
|
if (vault.kind !== "liquidity") throw new VaultResolutionError("invalid-vault", "Vault does not support liquidity snapshots");
|
|
21053
|
-
result.push(await read.readSnapshot(vault));
|
|
21076
|
+
result.push(this.#snapshotImplementation(await read.readSnapshot(vault), binding, vault.metadata.beaconName));
|
|
21054
21077
|
}
|
|
21055
21078
|
} else {
|
|
21056
21079
|
bulkSupported = false;
|
|
@@ -21066,7 +21089,7 @@ var VaultResolver = class {
|
|
|
21066
21089
|
if (!binding.readSnapshot) throw new VaultResolutionError("not-configured", "No verified snapshot reader configured for vault implementation");
|
|
21067
21090
|
const snapshot = await binding.readSnapshot(resolved);
|
|
21068
21091
|
if (snapshot.blockNumber !== blockNumber || !vault.underlying.some((position) => position.kind === "liquidity" && sameLiquidityPool(position.pool, snapshot.pool))) throw new Error("Vault returned another accounting snapshot");
|
|
21069
|
-
return readValidatedVaultSnapshot(vault, snapshot, steer.context);
|
|
21092
|
+
return this.#snapshotImplementation(await readValidatedVaultSnapshot(vault, snapshot, steer.context), binding, vault.metadata.beaconName);
|
|
21070
21093
|
})));
|
|
21071
21094
|
}
|
|
21072
21095
|
}
|