@iotexproject/kit 0.1.86 → 0.1.88

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,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import { RouteConfig } from '@asteasolutions/zod-to-openapi';
4
+ import DataLoader from 'dataloader';
4
5
  import postgres from 'postgres';
5
6
  import { PickByValue } from 'utility-types';
6
7
  import { z } from 'zod';
@@ -3477,6 +3478,21 @@ declare class IoID {
3477
3478
  data?: undefined;
3478
3479
  chainId?: undefined;
3479
3480
  }>;
3481
+ setWeight(args: {
3482
+ gaugeAddress: `0x${string}`;
3483
+ nftId: number;
3484
+ weight: number;
3485
+ }, ctx?: ConfigContext): Promise<{
3486
+ address: any;
3487
+ data: any;
3488
+ chainId: string;
3489
+ error?: undefined;
3490
+ } | {
3491
+ error: unknown;
3492
+ address?: undefined;
3493
+ data?: undefined;
3494
+ chainId?: undefined;
3495
+ }>;
3480
3496
  incrementMinterAllowance(args: {
3481
3497
  amount: string;
3482
3498
  address: `0x${string}`;
@@ -8649,6 +8665,7 @@ declare class BaseDBModule {
8649
8665
  depinscan: ReturnType<typeof postgres>;
8650
8666
  analysis: ClickHouseSDK;
8651
8667
  microServiceCenter: ReturnType<typeof postgres>;
8668
+ dao: ReturnType<typeof postgres>;
8652
8669
  constructor();
8653
8670
  checkAuth(key: string): Promise<{
8654
8671
  ok: boolean;
@@ -9066,6 +9083,51 @@ declare class Zkpass extends BaseDBModule {
9066
9083
  data: null;
9067
9084
  }>;
9068
9085
  }
9086
+ export type Proposal = {
9087
+ id: number;
9088
+ title: string;
9089
+ content: string;
9090
+ status: string;
9091
+ total_vote_weight?: number;
9092
+ voter_count?: number;
9093
+ yes_vote_count?: number;
9094
+ no_vote_count?: number;
9095
+ abstain_vote_count?: number;
9096
+ created_at: string;
9097
+ updated_at: string;
9098
+ start_time: string;
9099
+ end_time: string;
9100
+ };
9101
+ declare class Dao extends BaseDBModule {
9102
+ proposalsDataLoader: DataLoader<number, Proposal | undefined, number>;
9103
+ blockLoader: DataLoader<string, number | undefined, string>;
9104
+ voteWeightDataLoader: DataLoader<{
9105
+ height: number;
9106
+ address: string;
9107
+ }, string | undefined, {
9108
+ height: number;
9109
+ address: string;
9110
+ }>;
9111
+ getProposal({ id }: {
9112
+ id: number;
9113
+ }): Promise<Proposal | undefined>;
9114
+ getProposalListByIds({ ids }: {
9115
+ ids: readonly number[];
9116
+ }): Promise<import("postgres").RowList<Proposal[]>>;
9117
+ getProposalList(args: {
9118
+ status: string;
9119
+ orderBy: string;
9120
+ order: string;
9121
+ page: number;
9122
+ pageSize: number;
9123
+ }): Promise<import("postgres").RowList<Proposal[]>>;
9124
+ voteForProposal(args: {
9125
+ voter: string;
9126
+ message: string;
9127
+ signature: string;
9128
+ proposal_id: number;
9129
+ }): Promise<import("postgres").RowList<import("postgres").Row[]>>;
9130
+ }
9069
9131
  declare const modules$1: {
9070
9132
  account: Account;
9071
9133
  analyzer: Analyzer;
@@ -9082,6 +9144,7 @@ declare const modules$1: {
9082
9144
  verification: Verification;
9083
9145
  apis: Apis;
9084
9146
  zkpass: Zkpass;
9147
+ dao: Dao;
9085
9148
  };
9086
9149
  export type DBModuleType = typeof modules$1;
9087
9150
  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.86",
5
+ "version": "0.1.88",
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",