zigap-utils 0.0.810 → 1.0.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,10 @@
1
- import { AccountProvideType } from './types';
2
-
3
1
  declare class AirdropService {
4
- private isAccountType;
5
- getAccount(): Promise<AccountProvideType>;
6
- qrAirdrop(roomId: string): Promise<AccountProvideType>;
2
+ startAirdrop(roomId: string): Promise<{
3
+ isSuccess: boolean;
4
+ }>;
5
+ getAirdrop(roomId: string): Promise<{
6
+ isSuccess: boolean;
7
+ }>;
7
8
  }
8
9
  declare const _default: AirdropService;
9
10
  export default _default;
@@ -4,7 +4,7 @@ declare class CryptoService {
4
4
  private ec;
5
5
  constructor();
6
6
  xphereSign(msg: string, prKey: string): string;
7
- xphereVerify(msg: string, pubKey: string, sig: string): boolean;
7
+ xphereVerify(msg: string, pubKey: string, sig: string, address: string, network: string): boolean;
8
8
  generateKeys(): {
9
9
  privateKey: string;
10
10
  publicKey: string;
@@ -0,0 +1,15 @@
1
+ import { SendTransactionResultType, TransactionResultType } from './types';
2
+ import { TransactionType } from 'src/components/SendTransactionQR/SendTransactionQR.types';
3
+
4
+ declare class SendTransactionService {
5
+ getTransactionCrypto(): Promise<TransactionResultType>;
6
+ receiveRequest(roomId: string): Promise<{
7
+ roomId: string;
8
+ isSuccess: boolean;
9
+ }>;
10
+ sendMessage(roomId: string, message: string): Promise<void>;
11
+ checkVerified(roomId: string, verified: boolean): Promise<string>;
12
+ qrSendTransaction(roomId: string, transaction: TransactionType): Promise<SendTransactionResultType>;
13
+ }
14
+ declare const _default: SendTransactionService;
15
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { AccountCryptoType, ResponseSignatureType } from './types';
2
+
3
+ declare class SignatureService {
4
+ private isAccountCryptoType;
5
+ getAccountCrypto(): Promise<AccountCryptoType>;
6
+ receiveRequest(roomId: string): Promise<{
7
+ roomId: string;
8
+ isSuccess: boolean;
9
+ }>;
10
+ sendMessage(roomId: string, message: string): Promise<void>;
11
+ checkVerified(roomId: string, verified: boolean): Promise<string>;
12
+ qrSignature(roomId: string, message: string, nonce: string): Promise<ResponseSignatureType>;
13
+ }
14
+ declare const _default: SignatureService;
15
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { Socket } from 'socket.io-client';
2
+
3
+ declare class SocketService {
4
+ private socketInstance;
5
+ constructor();
6
+ joinRoom(roomId: string): void;
7
+ joinAirdropRoom(roomId: string): void;
8
+ leaveRoom(roomId: string): void;
9
+ confirmMessage(roomId: string, message: string): Socket;
10
+ checkVerified(roomId: string, verified: boolean): Socket;
11
+ checkResponse(roomId: string): Socket;
12
+ onAirdropResult(callback: (message: any) => void): void;
13
+ offAirdropResult(): void;
14
+ confirmSendTransaction(roomId: string, message: string): Socket;
15
+ onMessageReceived(type: string, callback: (message: any) => void): void;
16
+ offMessageReceived(type: string): void;
17
+ }
18
+ declare const _default: SocketService;
19
+ export default _default;
@@ -20,9 +20,24 @@ export interface ResponseLoginType {
20
20
  nickName: string;
21
21
  signature: string;
22
22
  publicKey: string;
23
+ isVerified: boolean;
23
24
  }
24
25
  export interface TransactionResultType {
26
+ status: string;
25
27
  txHash: string;
26
28
  from: string;
29
+ error: string;
30
+ }
31
+ export interface ResponseSignatureType {
32
+ signature: string;
33
+ publicKey: string;
34
+ address: string;
35
+ network: string;
36
+ message: string;
37
+ verified: boolean;
38
+ }
39
+ export interface SendTransactionResultType {
27
40
  status: string;
41
+ txHash: string;
42
+ error: string;
28
43
  }
@@ -0,0 +1,7 @@
1
+ import * as web3 from 'web3';
2
+ declare class EVM_Sign {
3
+ static address(private_key: string): string;
4
+ static signature(message: string, private_key: string): web3.SignResult;
5
+ static signatureValidity(message: string, address: string, signature: string): boolean;
6
+ }
7
+ export default EVM_Sign;
@@ -1,9 +1,9 @@
1
1
  declare class Util {
2
2
  string(input: any): string;
3
- stringToByte(str: string): Uint8Array;
3
+ stringToByte(str: string): Uint8Array<ArrayBuffer>;
4
4
  stringToUnicode(str: string): string;
5
5
  byteToHex(byte_array: Uint8Array): string;
6
- hexToByte(hex: string): Uint8Array;
6
+ hexToByte(hex: string): Uint8Array<ArrayBuffer>;
7
7
  isHex(input: any): boolean;
8
8
  }
9
9
  declare const _default: Util;
@@ -1,10 +1,11 @@
1
1
  import { QrType } from './types';
2
2
 
3
3
  declare class QrService {
4
- generateLoginQrCode(dapp: string, url: string, network: string[], icon: string | undefined): QrType;
4
+ generateLoginQrCode(dapp: string, url: string, network: string[], icon: string | undefined, method: 'login' | 'signature'): QrType;
5
5
  generateProvideQrCode(dapp: string, url: string, network: string[], icon: string | undefined): QrType;
6
6
  generatePaymentQrCode(dapp: string, network: string, address: string, amount: string, description: string | undefined, info: string | undefined): QrType;
7
7
  generateAirdropQrCode(dapp: string, network: string[], icon: string | undefined): QrType;
8
+ generateSendTransactionQrCode(dapp: string, networks: 'binance' | 'ethereum' | 'v2xphere' | 'v3xphere', url: string, icon: string | undefined): QrType;
8
9
  }
9
10
  export declare const Qr: QrService;
10
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigap-utils",
3
- "version": "0.0.810",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "scripts": {
18
18
  "preinstall": "npx only-allow pnpm",
19
19
  "dev": "vite",
20
- "build": "rm -rf dist && tsc -p ./tsconfig.node.json && tsx ./src/preprocessEnv.js && vite build",
20
+ "build": "rm -rf dist && tsc -p ./tsconfig.node.json && tsx ./src/preprocessEnv.ts && vite build",
21
21
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
22
22
  "preview": "vite preview"
23
23
  },
@@ -30,7 +30,8 @@
30
30
  "styled-components": "^6.1.11",
31
31
  "tsx": "^4.16.2",
32
32
  "tweetnacl": "^1.0.3",
33
- "vite-plugin-commonjs": "^0.10.1"
33
+ "vite-plugin-commonjs": "^0.10.1",
34
+ "web3": "^4.16.0"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@types/crypto-js": "^4.2.2",