zigap-utils 0.0.811 → 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.
- package/README.md +149 -115
- package/dist/components/LoginQR/LoginQR.types.d.ts +2 -0
- package/dist/components/SendTransactionQR/SendTransactionQR.d.ts +4 -0
- package/dist/components/SendTransactionQR/SendTransactionQR.types.d.ts +58 -0
- package/dist/components/SendTransactionQR/index.d.ts +2 -0
- package/dist/components/SignatureQR/SignatureQR.d.ts +4 -0
- package/dist/components/SignatureQR/SignatureQR.types.d.ts +59 -0
- package/dist/components/SignatureQR/index.d.ts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.es.js +9554 -5000
- package/dist/preprocessEnv.d.ts +1 -0
- package/dist/utils/cryptoUtils.d.ts +1 -1
- package/dist/utils/sendTransaction.d.ts +15 -0
- package/dist/utils/signature.d.ts +15 -0
- package/dist/utils/socketService.d.ts +6 -3
- package/dist/utils/types.d.ts +15 -0
- package/dist/xphere/evm-sign.d.ts +7 -0
- package/dist/zigap/qr.d.ts +2 -1
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
|
|
1
3
|
declare class SocketService {
|
|
2
4
|
private socketInstance;
|
|
3
5
|
constructor();
|
|
4
6
|
joinRoom(roomId: string): void;
|
|
5
7
|
joinAirdropRoom(roomId: string): void;
|
|
6
8
|
leaveRoom(roomId: string): void;
|
|
7
|
-
confirmMessage(roomId: string, message: string):
|
|
8
|
-
checkVerified(roomId: string, verified: boolean):
|
|
9
|
-
checkResponse(roomId: string):
|
|
9
|
+
confirmMessage(roomId: string, message: string): Socket;
|
|
10
|
+
checkVerified(roomId: string, verified: boolean): Socket;
|
|
11
|
+
checkResponse(roomId: string): Socket;
|
|
10
12
|
onAirdropResult(callback: (message: any) => void): void;
|
|
11
13
|
offAirdropResult(): void;
|
|
14
|
+
confirmSendTransaction(roomId: string, message: string): Socket;
|
|
12
15
|
onMessageReceived(type: string, callback: (message: any) => void): void;
|
|
13
16
|
offMessageReceived(type: string): void;
|
|
14
17
|
}
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -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;
|
package/dist/zigap/qr.d.ts
CHANGED
|
@@ -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
|
|
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.
|
|
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",
|