@iotexproject/kit 0.1.4 → 0.1.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/dist/index.d.ts CHANGED
@@ -4115,6 +4115,9 @@ declare class VerifyingProxyEntity {
4115
4115
  setDeviceGauge: (_gauge: `0x${string}`) => Promise<any>;
4116
4116
  setMetadata: (_name: string, _value: `0x${string}`) => Promise<any>;
4117
4117
  applyIoIDs: (_amount: string) => Promise<any>;
4118
+ register: (_verifySignature: string, _hash: string, //did hash
4119
+ _uri: string, //diddoc
4120
+ _owner: `0x${string}`, _device: `0x${string}`, _v: string, _r: string, _s: string) => Promise<any>;
4118
4121
  incrementMinterAllowance: (_amount: string) => Promise<any>;
4119
4122
  }
4120
4123
  export type ConfigContext = {
@@ -4227,6 +4230,27 @@ declare class IoID {
4227
4230
  }, ctx?: ConfigContext): Promise<IoIDDevice[] | {
4228
4231
  error: unknown;
4229
4232
  }>;
4233
+ register(args: {
4234
+ verifyingProxyAddress: `0x${string}`;
4235
+ verifySignature: string;
4236
+ didhash: string;
4237
+ didurl: string;
4238
+ owner: `0x${string}`;
4239
+ device: `0x${string}`;
4240
+ v: string;
4241
+ r: string;
4242
+ s: string;
4243
+ }, ctx?: ConfigContext): Promise<{
4244
+ address: `0x${string}`;
4245
+ data: any;
4246
+ chainId: string;
4247
+ error?: undefined;
4248
+ } | {
4249
+ error: unknown;
4250
+ address?: undefined;
4251
+ data?: undefined;
4252
+ chainId?: undefined;
4253
+ }>;
4230
4254
  }
4231
4255
  declare class VoterEntity {
4232
4256
  address: `0x${string}`;
@@ -8261,6 +8285,10 @@ declare class UseHub {
8261
8285
  blogs: import("@tryghost/content-api").PostsOrPages;
8262
8286
  marketData: IoTexMarketData;
8263
8287
  }>;
8288
+ twitter({ pageNo, pageSize }?: {
8289
+ pageNo: number;
8290
+ pageSize: number;
8291
+ }): Promise<any>;
8264
8292
  assets(): Promise<any[] | {
8265
8293
  error: unknown;
8266
8294
  }>;
@@ -8472,6 +8500,14 @@ declare class Contract extends BaseDBModule {
8472
8500
  getContractsDeployedCountByAccount({ address }: {
8473
8501
  address: string;
8474
8502
  }): Promise<number>;
8503
+ getContractByAddress({ address }: {
8504
+ address: string;
8505
+ }): Promise<{
8506
+ contract_byte_code: string;
8507
+ }>;
8508
+ getContractVerifiedByAddress({ address }: {
8509
+ address: string;
8510
+ }): Promise<import("postgres").Row>;
8475
8511
  }
8476
8512
  export type ComponentType = "banner-latest" | "iotex-2.0";
8477
8513
  export interface ComponentData {
@@ -8496,6 +8532,93 @@ declare const modules$1: {
8496
8532
  resource: Resource;
8497
8533
  };
8498
8534
  export type DBModuleType = typeof modules$1;
8535
+ declare const modules$2: {
8536
+ readonly contract: {
8537
+ getabi({ address }: {
8538
+ address: string;
8539
+ }): Promise<string>;
8540
+ getcontractcreation({ contractaddresses }: {
8541
+ contractaddresses: string;
8542
+ }): Promise<(Error | {
8543
+ contractCreator: string;
8544
+ contractCreatorIo: string;
8545
+ contractAddress: string;
8546
+ contractAddressIo: string;
8547
+ action_hash: string;
8548
+ })[] | null>;
8549
+ _getcontract({ address }: {
8550
+ address: string;
8551
+ }): Promise<{
8552
+ contract_byte_code: Buffer;
8553
+ }>;
8554
+ _checkverify({ address }: {
8555
+ address: string;
8556
+ }): Promise<boolean>;
8557
+ getsourcecode({ address }: {
8558
+ address: string;
8559
+ }): Promise<{
8560
+ SourceCode: any;
8561
+ ContractName: any;
8562
+ OptimizationUsed: any;
8563
+ CompilerVersion: any;
8564
+ EVMVersion: any;
8565
+ LicenseType: any;
8566
+ Runs: any;
8567
+ ABI: string;
8568
+ }[]>;
8569
+ checkverifystatus({ guid }: {
8570
+ guid: string;
8571
+ }): Promise<string>;
8572
+ verifysourcecode({ contractaddress, sourceCode, compilerversion, codeformat }: {
8573
+ codeformat: string;
8574
+ contractaddress: string;
8575
+ sourceCode: string;
8576
+ compilerversion: string;
8577
+ }): Promise<unknown>;
8578
+ analyzer: ReturnType<typeof import("postgres")>;
8579
+ scout: ReturnType<typeof import("postgres")>;
8580
+ superbase: ReturnType<typeof import("postgres")>;
8581
+ iotexscan: ReturnType<typeof import("postgres")>;
8582
+ iopay: ReturnType<typeof import("postgres")>;
8583
+ nftmarket: ReturnType<typeof import("postgres")>;
8584
+ ch: ClickHouseSDK;
8585
+ analysis: ReturnType<typeof import("postgres")>;
8586
+ checkAuth(key: string): Promise<{
8587
+ ok: boolean;
8588
+ message: string;
8589
+ }>;
8590
+ };
8591
+ readonly transaction: {
8592
+ getstatus({ txhash }: {
8593
+ txhash: string;
8594
+ }): Promise<{
8595
+ sender: string;
8596
+ recipient: string;
8597
+ bucket: import("postgres").Row;
8598
+ }>;
8599
+ analyzer: ReturnType<typeof import("postgres")>;
8600
+ scout: ReturnType<typeof import("postgres")>;
8601
+ superbase: ReturnType<typeof import("postgres")>;
8602
+ iotexscan: ReturnType<typeof import("postgres")>;
8603
+ iopay: ReturnType<typeof import("postgres")>;
8604
+ nftmarket: ReturnType<typeof import("postgres")>;
8605
+ ch: ClickHouseSDK;
8606
+ analysis: ReturnType<typeof import("postgres")>;
8607
+ checkAuth(key: string): Promise<{
8608
+ ok: boolean;
8609
+ message: string;
8610
+ }>;
8611
+ };
8612
+ };
8613
+ export type IotexscanModulesType = typeof modules$2;
8614
+ export type IotexscanAdapterType<T extends Record<string, Record<string, any>>> = {
8615
+ [key in keyof T]: {
8616
+ [key1 in keyof T[key]]: (arg: Parameters<T[key][key1]>[0] & {
8617
+ module: string;
8618
+ action: string;
8619
+ }) => ReturnType<T[key][key1]>;
8620
+ };
8621
+ };
8499
8622
  export declare const createClient: ({ url, ctx }?: {
8500
8623
  url?: string;
8501
8624
  ctx?: ConfigContext;
@@ -8507,5 +8630,9 @@ export declare const createClientWithWriteDBServer: ({ url, fetchRequestInit }:
8507
8630
  url?: string;
8508
8631
  fetchRequestInit?: FetchRequestInit;
8509
8632
  }) => DBModuleType;
8633
+ export declare const createIotexscanClient: ({ url, fetchRequestInit }: {
8634
+ url?: string;
8635
+ fetchRequestInit?: FetchRequestInit;
8636
+ }) => IotexscanAdapterType<IotexscanModulesType>;
8510
8637
 
8511
8638
  export {};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var N=({url:C="http://localhost:9527",ctx:D}={})=>new Proxy({},{get(J,G,M){return new Proxy({},{get(K,b){return async(j)=>{for(let B in j){if(typeof j[B]==="object")j[B]=JSON.stringify(j[B],(H,L)=>typeof L==="bigint"?L.toString():L);if(j[B]==null)delete j[B]}const F=`${C}/${String(G)}/${String(b)}?${new URLSearchParams(j).toString()}`;let z;if(D)z=await fetch(F,{headers:{...D}});else z=await fetch(F);return z.json()}}})}}),O=({url:C="http://localhost:9527"}={})=>new Proxy({},{get(D,J,G){return new Proxy({},{get(M,K){return async(b)=>{for(let z in b){if(typeof b[z]==="object")b[z]=JSON.stringify(b[z],(B,H)=>typeof H==="bigint"?H.toString():H);if(b[z]==null)delete b[z]}const j=`${C}/${String(J)}/${String(K)}?${new URLSearchParams(b).toString()}`;return(await fetch(j)).json()}}})}}),P=({url:C="http://localhost:9527",fetchRequestInit:D})=>new Proxy({},{get(J,G,M){return new Proxy({},{get(K,b){return async(j)=>{const F=`${C}/${String(G)}/${String(b)}`;return(await fetch(F,{method:"POST",...D,body:JSON.stringify(j)})).json()}}})}});export{P as createClientWithWriteDBServer,O as createClientWithDBServer,N as createClient};
1
+ var N=({url:B="http://localhost:9527",ctx:C}={})=>new Proxy({},{get(H,F,L){return new Proxy({},{get(J,b){return async(j)=>{for(let G in j){if(typeof j[G]==="object")j[G]=JSON.stringify(j[G],(K,M)=>typeof M==="bigint"?M.toString():M);if(j[G]==null)delete j[G]}const D=`${B}/${String(F)}/${String(b)}?${new URLSearchParams(j).toString()}`;let z;if(C)z=await fetch(D,{headers:{...C}});else z=await fetch(D);return z.json()}}})}}),O=({url:B="http://localhost:9527"}={})=>new Proxy({},{get(C,H,F){return new Proxy({},{get(L,J){return async(b)=>{for(let z in b){if(typeof b[z]==="object")b[z]=JSON.stringify(b[z],(G,K)=>typeof K==="bigint"?K.toString():K);if(b[z]==null)delete b[z]}const j=`${B}/${String(H)}/${String(J)}?${new URLSearchParams(b).toString()}`;return(await fetch(j)).json()}}})}}),P=({url:B="http://localhost:9527",fetchRequestInit:C})=>new Proxy({},{get(H,F,L){return new Proxy({},{get(J,b){return async(j)=>{const D=`${B}/${String(F)}/${String(b)}`;return(await fetch(D,{method:"POST",...C,body:JSON.stringify(j)})).json()}}})}}),Q=({url:B="http://localhost:9527",fetchRequestInit:C})=>new Proxy({},{get(H,F,L){return new Proxy({},{get(J,b){return async(j)=>{const D=`${B}/${String(F)}/${String(b)}?${new URLSearchParams(j).toString()}`;return(await fetch(D,{method:"GET",...C})).json()}}})}});export{Q as createIotexscanClient,P as createClientWithWriteDBServer,O as createClientWithDBServer,N as createClient};
package/package.json CHANGED
@@ -2,21 +2,25 @@
2
2
  "name": "@iotexproject/kit",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "v0.1.4",
5
+ "version": "v0.1.6",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "dev": "bun run build && bun run --watch server.ts",
9
+ "dev": "bun run build && bun run --watch server-kit.ts",
10
10
  "dev-db": "bun server-db.ts",
11
+ "dev-iotexscan": "bun server-iotexscan.ts",
11
12
  "test": "bun --hot run tests/test-marshalldao.ts",
12
13
  "build": "bun run build.mjs",
13
- "prepublishOnly": "bun run build"
14
+ "prepublishOnly": "bun run build",
15
+ "gen:grpc": "protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./lib/grpc/generated -I ./lib/grpc/protos ./lib/grpc/protos/*.proto"
14
16
  },
15
17
  "files": [
16
18
  "dist"
17
19
  ],
18
20
  "dependencies": {
19
21
  "@clickhouse/client": "^1.4.0",
22
+ "@grpc/grpc-js": "^1.11.1",
23
+ "@grpc/proto-loader": "^0.7.13",
20
24
  "@iotexproject/iotex-address-ts": "^1.0.4",
21
25
  "@tryghost/content-api": "^1.11.21",
22
26
  "axios": "^1.7.2",
@@ -24,6 +28,7 @@
24
28
  "bentocache": "^1.0.0-beta.9",
25
29
  "bignumber.js": "^9.1.2",
26
30
  "clickhouse": "^2.6.0",
31
+ "crypto-js": "^4.2.0",
27
32
  "dataloader": "^2.2.2",
28
33
  "dayjs": "^1.11.12",
29
34
  "graphql-request": "^7.1.0",
@@ -37,9 +42,14 @@
37
42
  "devDependencies": {
38
43
  "@dappworks/kit": "^0.4.198",
39
44
  "@types/bun": "latest",
45
+ "@types/crypto-js": "^4.2.2",
46
+ "@types/google-protobuf": "^3.15.12",
40
47
  "@types/tryghost__content-api": "^1.3.16",
41
48
  "bun-plugin-dts": "^0.2.3",
49
+ "grpc-tools": "^1.12.4",
50
+ "grpc_tools_node_protoc_ts": "^5.3.3",
42
51
  "hono": "^4.4.11",
52
+ "protoc-gen-ts": "^0.8.7",
43
53
  "typescript": "^5.5.4"
44
54
  },
45
55
  "publishConfig": {