@iotexproject/kit 0.1.87 → 0.1.89

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.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import { RouteConfig } from '@asteasolutions/zod-to-openapi';
4
+ import { BentoCache, bentostore } from 'bentocache';
5
+ import DataLoader from 'dataloader';
4
6
  import postgres from 'postgres';
5
7
  import { PickByValue } from 'utility-types';
6
8
  import { z } from 'zod';
@@ -8652,6 +8654,9 @@ declare class ClickHouseSDK {
8652
8654
  constructor(dbUrl: string);
8653
8655
  query(sql: string): Promise<any>;
8654
8656
  }
8657
+ declare const bento: BentoCache<{
8658
+ appCache: ReturnType<typeof bentostore>;
8659
+ }>;
8655
8660
  declare class BaseDBModule {
8656
8661
  ch: ClickHouseSDK;
8657
8662
  analyzer: ReturnType<typeof postgres>;
@@ -8664,6 +8669,8 @@ declare class BaseDBModule {
8664
8669
  depinscan: ReturnType<typeof postgres>;
8665
8670
  analysis: ClickHouseSDK;
8666
8671
  microServiceCenter: ReturnType<typeof postgres>;
8672
+ dao: ReturnType<typeof postgres>;
8673
+ cache: ReturnType<typeof bento.namespace>;
8667
8674
  constructor();
8668
8675
  checkAuth(key: string): Promise<{
8669
8676
  ok: boolean;
@@ -9081,6 +9088,54 @@ declare class Zkpass extends BaseDBModule {
9081
9088
  data: null;
9082
9089
  }>;
9083
9090
  }
9091
+ export type Proposal = {
9092
+ id: number;
9093
+ title: string;
9094
+ content: string;
9095
+ status: string;
9096
+ total_vote_weight?: number;
9097
+ voter_count?: number;
9098
+ yes_vote_count?: number;
9099
+ no_vote_count?: number;
9100
+ abstain_vote_count?: number;
9101
+ created_at: string;
9102
+ updated_at: string;
9103
+ start_time: string;
9104
+ end_time: string;
9105
+ };
9106
+ declare class Dao extends BaseDBModule {
9107
+ proposalsDataLoader: DataLoader<number, Proposal | undefined, number>;
9108
+ blockLoader: DataLoader<string, number | undefined, string>;
9109
+ voteWeightDataLoader: DataLoader<{
9110
+ height: number;
9111
+ address: string;
9112
+ }, string | undefined, {
9113
+ height: number;
9114
+ address: string;
9115
+ }>;
9116
+ getProposal({ id }: {
9117
+ id: number;
9118
+ }): Promise<Proposal | undefined>;
9119
+ getProposalListByIds({ ids }: {
9120
+ ids: readonly number[];
9121
+ }): Promise<import("postgres").RowList<Proposal[]>>;
9122
+ getProposalList(args: {
9123
+ status: string;
9124
+ orderBy: string;
9125
+ order: string;
9126
+ page: number;
9127
+ pageSize: number;
9128
+ }): Promise<{
9129
+ data: Proposal[] & Iterable<Proposal> & import("postgres").ResultQueryMeta<number, keyof Proposal>;
9130
+ total: number;
9131
+ }>;
9132
+ voteForProposal(args: {
9133
+ voter: string;
9134
+ message: string;
9135
+ signature: string;
9136
+ proposal_id: number;
9137
+ }): Promise<import("postgres").RowList<import("postgres").Row[]>>;
9138
+ }
9084
9139
  declare const modules$1: {
9085
9140
  account: Account;
9086
9141
  analyzer: Analyzer;
@@ -9097,6 +9152,7 @@ declare const modules$1: {
9097
9152
  verification: Verification;
9098
9153
  apis: Apis;
9099
9154
  zkpass: Zkpass;
9155
+ dao: Dao;
9100
9156
  };
9101
9157
  export type DBModuleType = typeof modules$1;
9102
9158
  export interface ConfigOptions {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var U=({url:j="http://localhost:9527",ctx:z}={})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{for(let K in b){if(typeof b[K]==="object")b[K]=JSON.stringify(b[K],(Q,N)=>typeof N==="bigint"?N.toString():N);if(b[K]==null)delete b[K]}const H=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`;let D;if(z)D=await fetch(H,{headers:{...z}});else D=await fetch(H);return D.json()}}})}}),S=async({args:j={},prop:z,method:L,url:B,fetchRequestInit:G})=>{if(!G?.method||G?.method==="GET"){for(let b in j){if(typeof j[b]==="object")j[b]=JSON.stringify(j[b],(H,D)=>typeof D==="bigint"?D.toString():D);if(j[b]==null)delete j[b]}const J=`${B}/${String(z)}/${String(L)}?${new URLSearchParams(j).toString()}`;return(await fetch(J,{...G})).json()}if(G?.method==="POST"){const J=`${B}/${String(z)}/${String(L)}`;return(await fetch(J,{...G,body:JSON.stringify(j)})).json()}},V=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{return S({args:b,prop:B,method:C,url:j,fetchRequestInit:z})}}})}}),W=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{return S({args:b,prop:B,method:C,url:j,fetchRequestInit:z})}}})}}),X=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{const H=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`;return(await fetch(H,{method:"GET",...z})).json()}}})}}),Y=({url:j="http://localhost:9527",ctx:z}={})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{let H=!1;for(let N in b){if(typeof b[N]==="object")H=!0;if(b[N]==null)delete b[N]}let D,K,Q={};if(H)D=`${j}/${String(B)}/${String(C)}`;else D=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`;if(z)Q.headers={...z};if(H)Q.method="POST",Q.body=JSON.stringify(b);return K=await fetch(D,Q),K.json()}}})}});export{X as createIotexscanClient,Y as createIoidClient,W as createClientWithIoPayServer,V as createClientWithDBServer,U as createClient};
1
+ var U=({url:j="http://localhost:9527",ctx:z}={})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{for(let K in b){if(typeof b[K]==="object")b[K]=JSON.stringify(b[K],(Q,N)=>typeof N==="bigint"?N.toString():N);if(b[K]==null)delete b[K]}let H=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`,D;if(z)D=await fetch(H,{headers:{...z}});else D=await fetch(H);return D.json()}}})}}),S=async({args:j={},prop:z,method:L,url:B,fetchRequestInit:G})=>{if(!G?.method||G?.method==="GET"){for(let b in j){if(typeof j[b]==="object")j[b]=JSON.stringify(j[b],(H,D)=>typeof D==="bigint"?D.toString():D);if(j[b]==null)delete j[b]}let J=`${B}/${String(z)}/${String(L)}?${new URLSearchParams(j).toString()}`;return(await fetch(J,{...G})).json()}if(G?.method==="POST"){let J=`${B}/${String(z)}/${String(L)}`;return(await fetch(J,{...G,body:JSON.stringify(j)})).json()}},V=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{return S({args:b,prop:B,method:C,url:j,fetchRequestInit:z})}}})}}),W=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{return S({args:b,prop:B,method:C,url:j,fetchRequestInit:z})}}})}}),X=({url:j="http://localhost:9527",fetchRequestInit:z})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{let H=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`;return(await fetch(H,{method:"GET",...z})).json()}}})}}),Y=({url:j="http://localhost:9527",ctx:z}={})=>new Proxy({},{get(L,B,G){return new Proxy({},{get(J,C){return async(b)=>{let H=!1;for(let N in b){if(typeof b[N]==="object")H=!0;if(b[N]==null)delete b[N]}let D,K,Q={};if(H)D=`${j}/${String(B)}/${String(C)}`;else D=`${j}/${String(B)}/${String(C)}?${new URLSearchParams(b).toString()}`;if(z)Q.headers={...z};if(H)Q.method="POST",Q.body=JSON.stringify(b);return K=await fetch(D,Q),K.json()}}})}});export{X as createIotexscanClient,Y as createIoidClient,W as createClientWithIoPayServer,V as createClientWithDBServer,U as createClient};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iotexproject/kit",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.1.87",
5
+ "version": "0.1.89",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -30,6 +30,7 @@
30
30
  "@tokenbound/sdk": "^0.5.5",
31
31
  "@tryghost/content-api": "^1.11.21",
32
32
  "@types/bn.js": "^5.1.6",
33
+ "@types/p-retry": "^3.0.1",
33
34
  "@types/utf8": "^3.0.3",
34
35
  "apollo-cache-inmemory": "^1.6.6",
35
36
  "apollo-client": "^2.6.10",
@@ -49,6 +50,7 @@
49
50
  "firebase-admin": "^12.6.0",
50
51
  "graphql-request": "^7.1.0",
51
52
  "graphql-tag": "^2.12.6",
53
+ "hono-pino": "^0.7.2",
52
54
  "hono-rate-limiter": "^0.4.0",
53
55
  "ioredis": "^5.4.1",
54
56
  "jsbi": "^4.3.0",
@@ -57,6 +59,7 @@
57
59
  "lodash": "^4.17.21",
58
60
  "lru-cache": "^11.0.0",
59
61
  "number-to-bn": "^1.7.0",
62
+ "p-retry": "^6.2.1",
60
63
  "p-timeout": "^6.1.3",
61
64
  "pg": "^8.13.1",
62
65
  "pg-format": "^1.0.4",