@iotexproject/kit 0.1.5 → 0.1.7

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,37 @@ 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
+ }>;
4254
+ did_hex(args: {
4255
+ did: `0x${string}`;
4256
+ owner: `0x${string}`;
4257
+ }, ctx?: ConfigContext): Promise<{
4258
+ hex: string;
4259
+ error?: undefined;
4260
+ } | {
4261
+ error: unknown;
4262
+ hex?: undefined;
4263
+ }>;
4230
4264
  }
4231
4265
  declare class VoterEntity {
4232
4266
  address: `0x${string}`;
@@ -8261,6 +8295,10 @@ declare class UseHub {
8261
8295
  blogs: import("@tryghost/content-api").PostsOrPages;
8262
8296
  marketData: IoTexMarketData;
8263
8297
  }>;
8298
+ twitter({ pageNo, pageSize }?: {
8299
+ pageNo: number;
8300
+ pageSize: number;
8301
+ }): Promise<any>;
8264
8302
  assets(): Promise<any[] | {
8265
8303
  error: unknown;
8266
8304
  }>;
@@ -8472,6 +8510,14 @@ declare class Contract extends BaseDBModule {
8472
8510
  getContractsDeployedCountByAccount({ address }: {
8473
8511
  address: string;
8474
8512
  }): Promise<number>;
8513
+ getContractByAddress({ address }: {
8514
+ address: string;
8515
+ }): Promise<{
8516
+ contract_byte_code: string;
8517
+ }>;
8518
+ getContractVerifiedByAddress({ address }: {
8519
+ address: string;
8520
+ }): Promise<import("postgres").Row>;
8475
8521
  }
8476
8522
  export type ComponentType = "banner-latest" | "iotex-2.0";
8477
8523
  export interface ComponentData {
@@ -8496,6 +8542,93 @@ declare const modules$1: {
8496
8542
  resource: Resource;
8497
8543
  };
8498
8544
  export type DBModuleType = typeof modules$1;
8545
+ declare const modules$2: {
8546
+ readonly contract: {
8547
+ getabi({ address }: {
8548
+ address: string;
8549
+ }): Promise<string>;
8550
+ getcontractcreation({ contractaddresses }: {
8551
+ contractaddresses: string;
8552
+ }): Promise<(Error | {
8553
+ contractCreator: string;
8554
+ contractCreatorIo: string;
8555
+ contractAddress: string;
8556
+ contractAddressIo: string;
8557
+ action_hash: string;
8558
+ })[] | null>;
8559
+ _getcontract({ address }: {
8560
+ address: string;
8561
+ }): Promise<{
8562
+ contract_byte_code: Buffer;
8563
+ }>;
8564
+ _checkverify({ address }: {
8565
+ address: string;
8566
+ }): Promise<boolean>;
8567
+ getsourcecode({ address }: {
8568
+ address: string;
8569
+ }): Promise<{
8570
+ SourceCode: any;
8571
+ ContractName: any;
8572
+ OptimizationUsed: any;
8573
+ CompilerVersion: any;
8574
+ EVMVersion: any;
8575
+ LicenseType: any;
8576
+ Runs: any;
8577
+ ABI: string;
8578
+ }[]>;
8579
+ checkverifystatus({ guid }: {
8580
+ guid: string;
8581
+ }): Promise<string>;
8582
+ verifysourcecode({ contractaddress, sourceCode, compilerversion, codeformat }: {
8583
+ codeformat: string;
8584
+ contractaddress: string;
8585
+ sourceCode: string;
8586
+ compilerversion: string;
8587
+ }): Promise<unknown>;
8588
+ analyzer: ReturnType<typeof import("postgres")>;
8589
+ scout: ReturnType<typeof import("postgres")>;
8590
+ superbase: ReturnType<typeof import("postgres")>;
8591
+ iotexscan: ReturnType<typeof import("postgres")>;
8592
+ iopay: ReturnType<typeof import("postgres")>;
8593
+ nftmarket: ReturnType<typeof import("postgres")>;
8594
+ ch: ClickHouseSDK;
8595
+ analysis: ReturnType<typeof import("postgres")>;
8596
+ checkAuth(key: string): Promise<{
8597
+ ok: boolean;
8598
+ message: string;
8599
+ }>;
8600
+ };
8601
+ readonly transaction: {
8602
+ getstatus({ txhash }: {
8603
+ txhash: string;
8604
+ }): Promise<{
8605
+ sender: string;
8606
+ recipient: string;
8607
+ bucket: import("postgres").Row;
8608
+ }>;
8609
+ analyzer: ReturnType<typeof import("postgres")>;
8610
+ scout: ReturnType<typeof import("postgres")>;
8611
+ superbase: ReturnType<typeof import("postgres")>;
8612
+ iotexscan: ReturnType<typeof import("postgres")>;
8613
+ iopay: ReturnType<typeof import("postgres")>;
8614
+ nftmarket: ReturnType<typeof import("postgres")>;
8615
+ ch: ClickHouseSDK;
8616
+ analysis: ReturnType<typeof import("postgres")>;
8617
+ checkAuth(key: string): Promise<{
8618
+ ok: boolean;
8619
+ message: string;
8620
+ }>;
8621
+ };
8622
+ };
8623
+ export type IotexscanModulesType = typeof modules$2;
8624
+ export type IotexscanAdapterType<T extends Record<string, Record<string, any>>> = {
8625
+ [key in keyof T]: {
8626
+ [key1 in keyof T[key]]: (arg: Parameters<T[key][key1]>[0] & {
8627
+ module: string;
8628
+ action: string;
8629
+ }) => ReturnType<T[key][key1]>;
8630
+ };
8631
+ };
8499
8632
  export declare const createClient: ({ url, ctx }?: {
8500
8633
  url?: string;
8501
8634
  ctx?: ConfigContext;
@@ -8507,5 +8640,9 @@ export declare const createClientWithWriteDBServer: ({ url, fetchRequestInit }:
8507
8640
  url?: string;
8508
8641
  fetchRequestInit?: FetchRequestInit;
8509
8642
  }) => DBModuleType;
8643
+ export declare const createIotexscanClient: ({ url, fetchRequestInit }: {
8644
+ url?: string;
8645
+ fetchRequestInit?: FetchRequestInit;
8646
+ }) => IotexscanAdapterType<IotexscanModulesType>;
8510
8647
 
8511
8648
  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.5",
5
+ "version": "v0.1.7",
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,8 +28,10 @@
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",
34
+ "ethers": "5.7.2",
29
35
  "graphql-request": "^7.1.0",
30
36
  "ioredis": "^5.4.1",
31
37
  "lru-cache": "^11.0.0",
@@ -37,9 +43,14 @@
37
43
  "devDependencies": {
38
44
  "@dappworks/kit": "^0.4.198",
39
45
  "@types/bun": "latest",
46
+ "@types/crypto-js": "^4.2.2",
47
+ "@types/google-protobuf": "^3.15.12",
40
48
  "@types/tryghost__content-api": "^1.3.16",
41
49
  "bun-plugin-dts": "^0.2.3",
50
+ "grpc-tools": "^1.12.4",
51
+ "grpc_tools_node_protoc_ts": "^5.3.3",
42
52
  "hono": "^4.4.11",
53
+ "protoc-gen-ts": "^0.8.7",
43
54
  "typescript": "^5.5.4"
44
55
  },
45
56
  "publishConfig": {