@iotexproject/kit 0.1.28 → 0.1.30

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
@@ -4133,6 +4133,7 @@ declare class VerifyingProxyEntity {
4133
4133
  export type ConfigContext = {
4134
4134
  chainId: string;
4135
4135
  appName: string;
4136
+ authData?: Record<string, any>;
4136
4137
  };
4137
4138
  declare class IoID {
4138
4139
  verfiyerProxyList(args: {
@@ -4222,11 +4223,12 @@ declare class IoID {
4222
4223
  chainId?: undefined;
4223
4224
  }>;
4224
4225
  setProjectMetadata(args: {
4226
+ key: string;
4225
4227
  address: `0x${string}`;
4226
4228
  metadata: ProjectMetadata;
4227
4229
  }, ctx?: ConfigContext): Promise<{
4228
4230
  address: `0x${string}`;
4229
- data: `0x${string}`;
4231
+ data: any;
4230
4232
  chainId: string;
4231
4233
  error?: undefined;
4232
4234
  } | {
@@ -8432,6 +8434,23 @@ export interface Candidate {
8432
8434
  export interface CandidateV3 extends Candidate {
8433
8435
  id: string;
8434
8436
  }
8437
+ export interface CompositeBucket {
8438
+ index: bigint;
8439
+ candidateAddress: string;
8440
+ stakedAmount: bigint;
8441
+ stakedDuration: number;
8442
+ createTime: bigint;
8443
+ stakeStartTime: bigint;
8444
+ unstakeStartTime: bigint;
8445
+ autoStake: boolean;
8446
+ owner: string;
8447
+ contractAddress: string;
8448
+ stakedDurationBlockNumber: bigint;
8449
+ createBlockHeight: bigint;
8450
+ stakeStartBlockHeight: bigint;
8451
+ unstakeStartBlockHeight: bigint;
8452
+ endorsementExpireBlockHeight: bigint;
8453
+ }
8435
8454
  export interface Bucket {
8436
8455
  index: bigint;
8437
8456
  candidateAddress: string;
@@ -8570,13 +8589,16 @@ declare class Staking {
8570
8589
  }): Promise<any>;
8571
8590
  getEndorseBucketsByDelegate(args: {
8572
8591
  ownerAddress: `0x${string}` | `io${string}`;
8573
- }): Promise<never[] | undefined>;
8592
+ }): Promise<CompositeBucket[]>;
8574
8593
  candidateTransferOwnership({ newOwner }: {
8575
8594
  newOwner: `0x${string}`;
8576
8595
  }): Promise<any>;
8577
8596
  candidateActivate({ bucketIndex }: {
8578
8597
  bucketIndex: string;
8579
8598
  }): Promise<any>;
8599
+ getSelfStakeBucketByDelegate(args: {
8600
+ ownerAddress: `0x${string}` | `io${string}`;
8601
+ }): Promise<CompositeBucket | null>;
8580
8602
  }
8581
8603
  declare class utils {
8582
8604
  erc20(args: {
@@ -8859,29 +8881,74 @@ declare class Analysis extends BaseDBModule {
8859
8881
  api_key: string;
8860
8882
  };
8861
8883
  }>;
8862
- create_ref({ device_id, refer_id, user_id, point }: {
8863
- device_id: string;
8884
+ upload_event({ user_id, event_type, event_id, event }: {
8885
+ event_type: string;
8886
+ user_id: string;
8887
+ event_id: string;
8888
+ event: Record<string, any>;
8889
+ }, ctx?: {
8890
+ authData?: {
8891
+ app_id: string;
8892
+ api_key: string;
8893
+ };
8894
+ }): Promise<{
8895
+ ok: boolean;
8896
+ msg: any;
8897
+ }>;
8898
+ generate_referral_code({ refer_id, }: {
8864
8899
  refer_id: string;
8900
+ }, ctx?: {
8901
+ authData?: {
8902
+ app_id: string;
8903
+ api_key: string;
8904
+ };
8905
+ }): Promise<{
8906
+ ok: boolean;
8907
+ referral_code: any;
8908
+ msg: string;
8909
+ } | {
8910
+ ok: boolean;
8911
+ msg: any;
8912
+ referral_code?: undefined;
8913
+ }>;
8914
+ fetch_referral_code({ user_id, }: {
8865
8915
  user_id: string;
8866
- point?: number;
8867
- }, authData?: {
8868
- app_id: string;
8869
- api_key: string;
8916
+ }, ctx?: {
8917
+ authData?: {
8918
+ app_id: string;
8919
+ api_key: string;
8920
+ };
8870
8921
  }): Promise<{
8922
+ ok: boolean;
8923
+ referral_code: any;
8924
+ msg?: undefined;
8925
+ } | {
8871
8926
  ok: boolean;
8872
8927
  msg: any;
8928
+ referral_code?: undefined;
8873
8929
  }>;
8874
- upload_event({ user_id, type, event }: {
8875
- type: string;
8930
+ create_refer({ refer_id, user_id, device_id, data, }: {
8931
+ refer_id: string;
8876
8932
  user_id: string;
8877
- event: Record<string, any>;
8878
- }, authData?: {
8879
- app_id: string;
8880
- api_key: string;
8933
+ device_id: string;
8934
+ data?: Record<string, any>;
8935
+ }, ctx?: {
8936
+ authData?: {
8937
+ app_id: string;
8938
+ api_key: string;
8939
+ };
8881
8940
  }): Promise<{
8882
8941
  ok: boolean;
8883
8942
  msg: any;
8884
8943
  }>;
8944
+ fetch_event({ event_id, }: {
8945
+ event_id: string;
8946
+ }, ctx?: {
8947
+ authData?: {
8948
+ app_id: string;
8949
+ api_key: string;
8950
+ };
8951
+ }): Promise<Record<string, any>>;
8885
8952
  }
8886
8953
  declare class Analyzer extends BaseDBModule {
8887
8954
  tvl(): Promise<any>;
@@ -8911,10 +8978,18 @@ declare class Analyzer extends BaseDBModule {
8911
8978
  start_date?: string;
8912
8979
  end_date?: string;
8913
8980
  }): Promise<any>;
8981
+ sumGasFeeIotx({ start_date, end_date }?: {
8982
+ start_date?: string;
8983
+ end_date?: string;
8984
+ }): Promise<any>;
8914
8985
  avgGasFee({ start_date, end_date }?: {
8915
8986
  start_date?: string;
8916
8987
  end_date?: string;
8917
8988
  }): Promise<any>;
8989
+ avgGasFeeIotx({ start_date, end_date }?: {
8990
+ start_date?: string;
8991
+ end_date?: string;
8992
+ }): Promise<any>;
8918
8993
  nodesCount(): Promise<any>;
8919
8994
  dappsCount(): Promise<any>;
8920
8995
  totalCrossChainTxCount(): Promise<number>;
@@ -9046,7 +9121,7 @@ declare class Staking$1 extends BaseDBModule {
9046
9121
  data?: undefined;
9047
9122
  }>;
9048
9123
  }
9049
- export type ComponentType = "banner-latest" | "iotex-2.0";
9124
+ export type ComponentType = "banner-latest" | "token-2049";
9050
9125
  export interface ComponentData {
9051
9126
  id: ComponentType;
9052
9127
  html: string;
@@ -9057,6 +9132,9 @@ declare class Resource {
9057
9132
  id: ComponentType;
9058
9133
  }): Promise<ComponentData>;
9059
9134
  }
9135
+ declare class IoPay extends BaseDBModule {
9136
+ get_point_task(): Promise<import("postgres").RowList<import("postgres").Row[]>>;
9137
+ }
9060
9138
  declare const modules$1: {
9061
9139
  account: Account;
9062
9140
  analyzer: Analyzer;
@@ -9067,10 +9145,12 @@ declare const modules$1: {
9067
9145
  analysis: Analysis;
9068
9146
  contract: Contract;
9069
9147
  resource: Resource;
9148
+ iopay: IoPay;
9070
9149
  };
9071
9150
  export type DBModuleType = typeof modules$1;
9072
9151
  export interface ConfigOptions {
9073
9152
  ttl: number;
9153
+ checkAuth?: boolean;
9074
9154
  }
9075
9155
  export type KitModuleFunction<I extends z.AnyZodObject = z.AnyZodObject, O extends z.ZodType | undefined = undefined, R = any> = {
9076
9156
  input?: I;
@@ -10116,18 +10196,44 @@ declare class Point {
10116
10196
  sub: string | undefined;
10117
10197
  };
10118
10198
  }>;
10119
- upload_event(args: {
10120
- user_id: string;
10121
- event_name: string;
10122
- point: number;
10123
- } & Record<string, any>, authData?: {
10124
- sub: string;
10199
+ upload_event({ action_id, }: {
10200
+ action_id: number;
10201
+ device_id?: string;
10202
+ refer_id?: string;
10203
+ }, ctx?: {
10204
+ authData?: {
10205
+ sub: string;
10206
+ };
10125
10207
  }): Promise<any>;
10126
- create_ref(args: {
10127
- refer_id: string;
10128
- user_id: string;
10129
- }, authData?: {
10130
- sub: string;
10208
+ generate_referral_code(args?: any, ctx?: {
10209
+ authData?: {
10210
+ sub: string;
10211
+ };
10212
+ }): Promise<any>;
10213
+ fetch_referral_code(args?: any, ctx?: {
10214
+ authData?: {
10215
+ sub: string;
10216
+ };
10217
+ }): Promise<any>;
10218
+ create_refer({ referral_code, device_id, }: {
10219
+ referral_code: string;
10220
+ device_id: string;
10221
+ }, ctx?: {
10222
+ authData?: {
10223
+ sub: string;
10224
+ };
10225
+ }): Promise<any>;
10226
+ fetch_event({ event_id }: {
10227
+ event_id: string;
10228
+ }, ctx?: {
10229
+ authData?: {
10230
+ sub: string;
10231
+ };
10232
+ }): Promise<any>;
10233
+ my_point_tasks(args?: any, ctx?: {
10234
+ authData?: {
10235
+ sub: string;
10236
+ };
10131
10237
  }): Promise<any>;
10132
10238
  }
10133
10239
  declare const modules$4: {
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)).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 L=({url:A="http://localhost:9527",ctx:B}={})=>new Proxy({},{get(G,C,j){return new Proxy({},{get(z,D){return async(T)=>{for(let E in T){if(typeof T[E]==="object")T[E]=JSON.stringify(T[E],(J,H)=>typeof H==="bigint"?H.toString():H);if(T[E]==null)delete T[E]}const w=`${A}/${String(C)}/${String(D)}?${new URLSearchParams(T).toString()}`;let b;if(B)b=await fetch(w,{headers:{...B}});else b=await fetch(w);return b.json()}}})}}),K=async({args:A={},prop:B,method:G,url:C,fetchRequestInit:j})=>{if(!j?.method||j?.method==="GET"){for(let T in A){if(typeof A[T]==="object")A[T]=JSON.stringify(A[T],(w,b)=>typeof b==="bigint"?b.toString():b);if(A[T]==null)delete A[T]}const z=`${C}/${String(B)}/${String(G)}?${new URLSearchParams(A).toString()}`;return(await fetch(z,{...j})).json()}if(j?.method==="POST"){const z=`${C}/${String(B)}/${String(G)}`;return(await fetch(z,{...j,body:JSON.stringify(A)})).json()}},N=({url:A="http://localhost:9527",fetchRequestInit:B})=>new Proxy({},{get(G,C,j){return new Proxy({},{get(z,D){return async(T)=>{return K({args:T,prop:C,method:D,url:A,fetchRequestInit:B})}}})}}),Q=({url:A="http://localhost:9527",fetchRequestInit:B})=>new Proxy({},{get(G,C,j){return new Proxy({},{get(z,D){return async(T)=>{return K({args:T,prop:C,method:D,url:A,fetchRequestInit:B})}}})}}),S=({url:A="http://localhost:9527",fetchRequestInit:B})=>new Proxy({},{get(G,C,j){return new Proxy({},{get(z,D){return async(T)=>{const w=`${A}/${String(C)}/${String(D)}?${new URLSearchParams(T).toString()}`;return(await fetch(w,{method:"GET",...B})).json()}}})}}),U=({url:A="http://localhost:9527",ctx:B}={})=>new Proxy({},{get(G,C,j){return new Proxy({},{get(z,D){return async(T)=>{let w=!1;for(let H in T){if(typeof T[H]==="object")w=!0;if(T[H]==null)delete T[H]}let b,E,J={};if(w)b=`${A}/${String(C)}/${String(D)}`;else b=`${A}/${String(C)}/${String(D)}?${new URLSearchParams(T).toString()}`;if(B)J.headers={...B};if(w)J.method="POST",J.body=JSON.stringify(T);return E=await fetch(b,J),E.json()}}})}});export{S as createIotexscanClient,U as createIoidClient,Q as createClientWithIoPayServer,N as createClientWithDBServer,L 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": "v0.1.28",
5
+ "version": "v0.1.30",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {