@bgd-labs/toolbox 0.0.28 → 0.0.29

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/dist/index.d.mts CHANGED
@@ -14030,7 +14030,7 @@ declare function parseLogs({ logs, eventDb }: ParseLogsArgs): LogType[];
14030
14030
  * @param logs
14031
14031
  * @returns
14032
14032
  */
14033
- declare function enhanceLogs(client: Client, logs: LogType[]): Promise<(LogType | undefined)[]>;
14033
+ declare function enhanceLogs(client: Client, logs: LogType[]): Promise<LogType[]>;
14034
14034
 
14035
14035
  declare enum SelfdestructCheckState {
14036
14036
  TRUSTED = 0,
@@ -14117,6 +14117,7 @@ type StreamChangedType = {
14117
14117
  tokenAddress?: Address;
14118
14118
  ratePerSecond?: string;
14119
14119
  remainingBalance?: string;
14120
+ deposit?: string;
14120
14121
  };
14121
14122
  type InterestDataChangedType = {
14122
14123
  optimalUsageRatio: number | string;
@@ -14129,8 +14130,12 @@ type ChangeMap = {
14129
14130
  _streams: StreamChangedType;
14130
14131
  _interestRateData: InterestDataChangedType;
14131
14132
  assetsSources: string;
14132
- _balances: string;
14133
- _allowances: string;
14133
+ totalSupply: string;
14134
+ _balances: Record<string, string>;
14135
+ _allowances: Record<string, string>;
14136
+ balanceOf: Record<string, string>;
14137
+ allowed: Record<string, string>;
14138
+ balances: Record<string, string>;
14134
14139
  };
14135
14140
  type Change<TName extends string = string> = {
14136
14141
  type: string;
package/dist/index.d.ts CHANGED
@@ -14030,7 +14030,7 @@ declare function parseLogs({ logs, eventDb }: ParseLogsArgs): LogType[];
14030
14030
  * @param logs
14031
14031
  * @returns
14032
14032
  */
14033
- declare function enhanceLogs(client: Client, logs: LogType[]): Promise<(LogType | undefined)[]>;
14033
+ declare function enhanceLogs(client: Client, logs: LogType[]): Promise<LogType[]>;
14034
14034
 
14035
14035
  declare enum SelfdestructCheckState {
14036
14036
  TRUSTED = 0,
@@ -14117,6 +14117,7 @@ type StreamChangedType = {
14117
14117
  tokenAddress?: Address;
14118
14118
  ratePerSecond?: string;
14119
14119
  remainingBalance?: string;
14120
+ deposit?: string;
14120
14121
  };
14121
14122
  type InterestDataChangedType = {
14122
14123
  optimalUsageRatio: number | string;
@@ -14129,8 +14130,12 @@ type ChangeMap = {
14129
14130
  _streams: StreamChangedType;
14130
14131
  _interestRateData: InterestDataChangedType;
14131
14132
  assetsSources: string;
14132
- _balances: string;
14133
- _allowances: string;
14133
+ totalSupply: string;
14134
+ _balances: Record<string, string>;
14135
+ _allowances: Record<string, string>;
14136
+ balanceOf: Record<string, string>;
14137
+ allowed: Record<string, string>;
14138
+ balances: Record<string, string>;
14134
14139
  };
14135
14140
  type Change<TName extends string = string> = {
14136
14141
  type: string;
package/dist/index.js CHANGED
@@ -33181,6 +33181,7 @@ function enhanceLogs(client, logs) {
33181
33181
  }
33182
33182
  return log;
33183
33183
  }
33184
+ return log;
33184
33185
  })
33185
33186
  );
33186
33187
  }
@@ -33584,18 +33585,26 @@ async function enhanceStateDiff(client, diff) {
33584
33585
  }
33585
33586
  if (isChangeOfType(change, "_streams")) {
33586
33587
  await formatBeforeAndAfter(change, async (data) => {
33587
- if (data.tokenAddress && data.ratePerSecond && data.remainingBalance) {
33588
+ if (data.tokenAddress) {
33588
33589
  const assetInfo = await findAsset(client, data.tokenAddress);
33589
- change.after.ratePerSecond = prettifyNumber({
33590
- decimals: assetInfo.decimals,
33591
- value: data.ratePerSecond,
33592
- showDecimals: true
33593
- });
33594
- change.after.remainingBalance = prettifyNumber({
33595
- showDecimals: true,
33596
- decimals: assetInfo.decimals,
33597
- value: data.remainingBalance
33598
- });
33590
+ if (data.ratePerSecond)
33591
+ data.ratePerSecond = prettifyNumber({
33592
+ decimals: assetInfo.decimals,
33593
+ value: data.ratePerSecond,
33594
+ showDecimals: true
33595
+ });
33596
+ if (data.remainingBalance)
33597
+ data.remainingBalance = prettifyNumber({
33598
+ showDecimals: true,
33599
+ decimals: assetInfo.decimals,
33600
+ value: data.remainingBalance
33601
+ });
33602
+ if (data.deposit)
33603
+ data.deposit = prettifyNumber({
33604
+ showDecimals: true,
33605
+ decimals: assetInfo.decimals,
33606
+ value: data.deposit
33607
+ });
33599
33608
  }
33600
33609
  return data;
33601
33610
  });
@@ -33605,15 +33614,31 @@ async function enhanceStateDiff(client, diff) {
33605
33614
  return addAssetPrice(client, data);
33606
33615
  });
33607
33616
  }
33608
- if (isChangeOfType(change, "_allowances") || isChangeOfType(change, "_balances")) {
33617
+ if (change.type === "mapping (address => uint256)" || isChangeOfType(change, "totalSupply")) {
33609
33618
  await formatBeforeAndAfter(change, async (data) => {
33610
33619
  const asset = await findAsset(client, key);
33611
- if (asset)
33620
+ if (asset) {
33612
33621
  return prettifyNumber({
33613
33622
  decimals: asset.decimals,
33614
33623
  value: data,
33615
33624
  showDecimals: true
33616
33625
  });
33626
+ }
33627
+ return data;
33628
+ });
33629
+ }
33630
+ if (isChangeOfType(change, "_allowances") || isChangeOfType(change, "allowed")) {
33631
+ await formatBeforeAndAfter(change, async (data) => {
33632
+ const asset = await findAsset(client, key);
33633
+ if (asset && typeof data === "object") {
33634
+ Object.keys(data).forEach((key2) => {
33635
+ data[key2] = prettifyNumber({
33636
+ decimals: asset.decimals,
33637
+ value: data[key2],
33638
+ showDecimals: true
33639
+ });
33640
+ });
33641
+ }
33617
33642
  return data;
33618
33643
  });
33619
33644
  }
@@ -33750,6 +33775,7 @@ ${payload.actions.map(
33750
33775
  report += "\n";
33751
33776
  }
33752
33777
  if (logs.length) {
33778
+ console.log(logs);
33753
33779
  report += "### Events emitted from the proposal\n\n";
33754
33780
  report += "| Address | Event Name | Arguments |\n";
33755
33781
  report += "|---------|------------|-----------|\n";