@superorange/zka-js-sdk 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 ADDED
@@ -0,0 +1,157 @@
1
+ # zkAttestation-js-sdk
2
+ pado extension zkAttestation js sdk
3
+
4
+ ## 1. Overview
5
+
6
+ This is PADO Extension SDK of PADO Network for dapps developer. PADO Extension is:
7
+
8
+ - [PADO Extension](https://github.com/pado-labs/pado-extension.git)
9
+
10
+ ## 2. Installation
11
+
12
+ You can install it via npm or yarn:
13
+
14
+ ### Using npm
15
+
16
+ ```shell
17
+ npm install --save @padolabs/zkattestation-js-sdk
18
+ ```
19
+
20
+ ### Or using yarn
21
+
22
+ ```shell
23
+ yarn add --save @padolabs/zkattestation-js-sdk
24
+ ```
25
+
26
+ ## 3. Quick Start
27
+
28
+ ```typescript
29
+ import { ZkAttestationJSSDK } from "@padolabs/zkattestation-js-sdk";
30
+
31
+ const myInstance = new ZkAttestationJSSDK();
32
+ console.log(myInstance.supportedChainNameList); // Outputs the list of supported chain names
33
+ ```
34
+
35
+ ## 4. Classes and Interfaces
36
+
37
+ ### 4.1 ZkAttestationJSSDK
38
+
39
+ ZkAttestationJSSDK is the core class in the @padolabs/zkattestation-js-sdk package that provides support for specific functionalities.
40
+
41
+ **Properties**
42
+
43
+ - `isInitialized: boolean` Indicates whether the class has been initialized.
44
+ - `isInstalled: boolean` Indicates whether pado extension has been installed.
45
+ - `supportedChainNameList: string[]` List of supported chain names.
46
+
47
+ **Constructor**
48
+ constructor(): Initializes the class properties.
49
+ **Example**
50
+
51
+ ```typescript
52
+ import { ZkAttestationJSSDK } from "@padolabs/zkattestation-js-sdk";
53
+
54
+ const myInstance = new ZkAttestationJSSDK();
55
+
56
+ // Initialization status
57
+ console.log(myInstance.isInitialized); // Output: false
58
+
59
+ // Pado installation status
60
+ console.log(myInstance.isInstalled); // Output: false
61
+
62
+ // Supported chain name list
63
+ console.log(myInstance.supportedChainNameList); // Output: ['Linea Mainnet', "BSC", "opBNB", "Arbitrum", "Scroll Mainnet"]
64
+ ```
65
+
66
+ ## 5. Methods
67
+
68
+ ### 5.1 startAttestation
69
+
70
+ The startAttestation method initiates the attestation process.
71
+
72
+ **Parameters**
73
+
74
+ - `attestationParams: AttestationParams` Information required to initiate the attestation.
75
+
76
+ **Return Value**
77
+
78
+ - `Promise<boolean>` Returns a Promise boolean that resolves when the attestation is completed.
79
+ **Example**
80
+
81
+ ```typescript
82
+ import { ZkAttestationJSSDK } from "@padolabs/zkattestation-js-sdk";
83
+
84
+ const myInstance = new ZkAttestationJSSDK();
85
+
86
+ myInstance
87
+ .startAttestation({
88
+ chainName: "BSC",
89
+ walletAddress: "0x8F0D4188307496926d785fB00E08Ed772f3be890",
90
+ attestationTypeId: "9",
91
+ assetsBalance: "0.1",
92
+ // tokenSymbol: "USDT",
93
+ // followersCount: "1",
94
+ })
95
+ .then(() => {
96
+ console.log("Attestation successful");
97
+ })
98
+ .catch((error) => {
99
+ console.error("Attestation failed:", error);
100
+ });
101
+ ```
102
+
103
+ ### 5.2 verifyAttestation
104
+
105
+ The verifyAttestation method verifies the attestation results.
106
+
107
+ **Parameters**
108
+
109
+ - `eip712MSg:any` Attestation data.
110
+ **Return Value**
111
+ - `isValid:boolean` Returns whether the verification successful.
112
+ **Example**
113
+
114
+ ```typescript
115
+ import { ZkAttestationJSSDK } from '@padolabs/zkattestation-js-sdk';
116
+
117
+ const myInstance = new ZkAttestationJSSDK();
118
+
119
+ const attestationData = {/_ ...attestation data _/};
120
+
121
+ myInstance.verifyAttestation(attestationData).then((result) => {
122
+ console.log('Verification result:', result);
123
+ }).catch((error) => {
124
+ console.error('Verification failed:', error);
125
+ });
126
+ ```
127
+
128
+ ### 5.3 sendToChain
129
+
130
+ The sendToChain method sends data to the specified blockchain.
131
+ **Parameters**
132
+
133
+ - `eip712MSg:any` Attestation data.
134
+ **Return Value**
135
+ - `isValid:boolean` Returns whether the data has been successfully sent to the specified blockchain.
136
+
137
+ **Example**
138
+
139
+ ```typescript
140
+ import { ZkAttestationJSSDK } from "@padolabs/zkattestation-js-sdk";
141
+
142
+ const myInstance = new ZkAttestationJSSDK();
143
+
144
+ myInstance
145
+ .sendToChain({
146
+ chainName: "chain1",
147
+ data: { key: "value" },
148
+ })
149
+ .then(() => {
150
+ console.log("Data sent successfully");
151
+ })
152
+ .catch((error) => {
153
+ console.error("Data sending failed:", error);
154
+ });
155
+ ```
156
+
157
+ This documentation covers the startAttestation, verifyAttestation, and sendToChain methods in detail. These methods enable you to implement attestation and data transmission in your applications. If you need further customization or have other specific requirements, please let me know.
@@ -0,0 +1,173 @@
1
+ export declare const PADOEXTENSIONID = "oeiomhmbaapihbilkfkhmlajkeegnjhe";
2
+ export declare const ONESECOND = 1000;
3
+ export declare const ONEMINUTE: number;
4
+ export declare const ATTESTATIONPOLLINGTIME: number;
5
+ export declare const ATTESTATIONPOLLINGTIMEOUT: number;
6
+ export declare const PADOADDRESS: string;
7
+ export declare const EASInfo: {
8
+ 'Scroll Sepolia': {
9
+ showName: string;
10
+ title: string;
11
+ rpcUrl: string;
12
+ erc721Contract: string;
13
+ easContact: string;
14
+ easProxyContrac: string;
15
+ easProxyFeeContract: string;
16
+ schemas: {
17
+ 'Verax-Scroll-Sepolia': {
18
+ schemaUid: string;
19
+ schemaUidTokenHoldings: string;
20
+ schemaUidIdentification: string;
21
+ schemaUidWeb: string;
22
+ };
23
+ PolygonID: {
24
+ schemaUid: string;
25
+ schemaUidTokenHoldings: string;
26
+ schemaUidIdentification: string;
27
+ };
28
+ };
29
+ chainId: string;
30
+ chainName: string;
31
+ rpcUrls: string[];
32
+ blockExplorerUrls: string[];
33
+ nativeCurrency: {
34
+ name: string;
35
+ symbol: string;
36
+ decimals: number;
37
+ };
38
+ transactionDetailUrl: string;
39
+ };
40
+ 'Linea Goerli': {
41
+ showName: string;
42
+ title: string;
43
+ rpcUrl: string;
44
+ erc721Contract: string;
45
+ easContact: string;
46
+ easProxyContrac: string;
47
+ easProxyFeeContract: string;
48
+ schemas: {
49
+ 'Verax-Linea-Goerli': {
50
+ schemaUid: string;
51
+ schemaUidTokenHoldings: string;
52
+ schemaUidIdentification: string;
53
+ schemaUidWeb: string;
54
+ };
55
+ PolygonID: {
56
+ schemaUid: string;
57
+ schemaUidTokenHoldings: string;
58
+ schemaUidIdentification: string;
59
+ };
60
+ };
61
+ chainId: string;
62
+ chainName: string;
63
+ rpcUrls: string[];
64
+ blockExplorerUrls: string[];
65
+ nativeCurrency: {
66
+ name: string;
67
+ symbol: string;
68
+ decimals: number;
69
+ };
70
+ transactionDetailUrl: string;
71
+ };
72
+ Sepolia: {
73
+ showName: string;
74
+ title: string;
75
+ rpcUrl: string;
76
+ erc721Contract: string;
77
+ easContact: string;
78
+ easProxyContrac: string;
79
+ easProxyFeeContract: string;
80
+ schemas: {
81
+ EAS: {
82
+ schemaUid: string;
83
+ schemaUidTokenHoldings: string;
84
+ schemaUidIdentification: string;
85
+ schemaUidWeb: string;
86
+ };
87
+ PolygonID: {
88
+ schemaUid: string;
89
+ schemaUidTokenHoldings: string;
90
+ schemaUidIdentification: string;
91
+ };
92
+ };
93
+ chainId: string;
94
+ chainName: string;
95
+ rpcUrls: string[];
96
+ blockExplorerUrls: string[];
97
+ nativeCurrency: {
98
+ name: string;
99
+ symbol: string;
100
+ decimals: number;
101
+ };
102
+ transactionDetailUrl: string;
103
+ };
104
+ BSC: {
105
+ showName: string;
106
+ title: string;
107
+ rpcUrl: string;
108
+ easContact: string;
109
+ easProxyFeeContract: string;
110
+ schemas: {
111
+ 'BAS-BSC-Testnet': {
112
+ schemaUid: string;
113
+ schemaUidTokenHoldings: string;
114
+ schemaUidIdentification: string;
115
+ schemaUidWeb: string;
116
+ };
117
+ PolygonID: {
118
+ schemaUid: string;
119
+ schemaUidTokenHoldings: string;
120
+ schemaUidIdentification: string;
121
+ };
122
+ };
123
+ chainId: string;
124
+ chainName: string;
125
+ rpcUrls: string[];
126
+ blockExplorerUrls: string[];
127
+ nativeCurrency: {
128
+ name: string;
129
+ symbol: string;
130
+ decimals: number;
131
+ };
132
+ transactionDetailUrl: string;
133
+ };
134
+ opBNB: {
135
+ showName: string;
136
+ title: string;
137
+ rpcUrl: string;
138
+ easContact: string;
139
+ easProxyFeeContract: string;
140
+ schemas: {
141
+ 'Ethsign-opBNB-Testnet': {
142
+ schemaUid: string;
143
+ schemaUidTokenHoldings: string;
144
+ schemaUidIdentification: string;
145
+ schemaUidWeb: string;
146
+ };
147
+ PolygonID: {
148
+ schemaUid: string;
149
+ schemaUidTokenHoldings: string;
150
+ schemaUidIdentification: string;
151
+ };
152
+ };
153
+ chainId: string;
154
+ chainName: string;
155
+ rpcUrls: string[];
156
+ blockExplorerUrls: string[];
157
+ nativeCurrency: {
158
+ name: string;
159
+ symbol: string;
160
+ decimals: number;
161
+ };
162
+ transactionDetailUrl: string;
163
+ bucketDetailUrl: string;
164
+ };
165
+ };
166
+ export declare const CHAINNAMELIST: {
167
+ text: string;
168
+ value: string;
169
+ }[];
170
+ export declare const ATTESTATIONTYPEIDLIST: {
171
+ text: string;
172
+ value: string;
173
+ }[];