zkcloudworker 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/index.d.ts +3 -2
- package/lib/ts/src/index.js +3 -2
- package/lib/ts/src/utils/base64.d.ts +5 -0
- package/lib/ts/src/utils/base64.js +90 -0
- package/lib/ts/src/{fetch.js → utils/fetch.js} +24 -6
- package/lib/ts/src/utils/fields.d.ts +3 -0
- package/lib/ts/src/utils/fields.js +33 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/api/api.js +263 -286
- package/lib/web/src/api/api.js.map +1 -1
- package/lib/web/src/cloud/cloud.js +12 -25
- package/lib/web/src/cloud/cloud.js.map +1 -1
- package/lib/web/src/cloud/files.js +59 -68
- package/lib/web/src/cloud/files.js.map +1 -1
- package/lib/web/src/cloud/local.js +221 -259
- package/lib/web/src/cloud/local.js.map +1 -1
- package/lib/web/src/encryption/encryption.js +2 -5
- package/lib/web/src/encryption/encryption.js.map +1 -1
- package/lib/web/src/encryption/messages.js +24 -29
- package/lib/web/src/encryption/messages.js.map +1 -1
- package/lib/web/src/encryption/nats-client.js +67 -83
- package/lib/web/src/encryption/nats-client.js.map +1 -1
- package/lib/web/src/fee.js +3 -6
- package/lib/web/src/fee.js.map +1 -1
- package/lib/web/src/index.d.ts +3 -2
- package/lib/web/src/index.js +3 -2
- package/lib/web/src/index.js.map +1 -1
- package/lib/web/src/mina.js +60 -67
- package/lib/web/src/mina.js.map +1 -1
- package/lib/web/src/utils/base64.d.ts +5 -0
- package/lib/web/src/utils/base64.js +84 -0
- package/lib/web/src/utils/base64.js.map +1 -0
- package/lib/web/src/utils/fetch.js +79 -0
- package/lib/web/src/utils/fetch.js.map +1 -0
- package/lib/web/src/utils/fields.d.ts +3 -0
- package/lib/web/src/utils/fields.js +29 -0
- package/lib/web/src/utils/fields.js.map +1 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/ts/src/api/client-api.d.ts +0 -147
- package/lib/ts/src/api/client-api.js +0 -122
- package/lib/web/src/api/client-api.d.ts +0 -147
- package/lib/web/src/api/client-api.js +0 -134
- package/lib/web/src/api/client-api.js.map +0 -1
- package/lib/web/src/fetch.js +0 -68
- package/lib/web/src/fetch.js.map +0 -1
- /package/lib/ts/src/{fetch.d.ts → utils/fetch.d.ts} +0 -0
- /package/lib/web/src/{fetch.d.ts → utils/fetch.d.ts} +0 -0
@@ -1,122 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.zkCloudWorkerAPI = void 0;
|
4
|
-
class zkCloudWorkerAPI {
|
5
|
-
constructor(apiKey) {
|
6
|
-
this.API_KEY = "";
|
7
|
-
this.API_KEY = apiKey;
|
8
|
-
}
|
9
|
-
/**
|
10
|
-
* prove() sign() and send()
|
11
|
-
*
|
12
|
-
* The called cloud worker is expected to compile the needed Contract,
|
13
|
-
* create the transaction, prove it and send it back serialized.
|
14
|
-
*
|
15
|
-
* Then the serialized transaction can be signed locally using AuroWallet
|
16
|
-
* and finally send it to MINA using the cloud worker.
|
17
|
-
*
|
18
|
-
* IMPORTANT: the transaction fee will be paid by the local sender, using
|
19
|
-
* the Auro Wallet at the moment of signing the serialized transaction.
|
20
|
-
*
|
21
|
-
* We only need the sender public key to create and prove the transaction.
|
22
|
-
* The sender private key NEVER leaves the local wallet.
|
23
|
-
*
|
24
|
-
* Example:
|
25
|
-
* ~~~
|
26
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
27
|
-
*
|
28
|
-
* let serializedTxn = await zkWorker.prove('batch-voting-...', {
|
29
|
-
* data: {
|
30
|
-
* claimUid: '012345...789',
|
31
|
-
* // ...
|
32
|
-
* },
|
33
|
-
* options: {
|
34
|
-
* senderAddress: 'B62...',
|
35
|
-
* fee: MIN_FEE // MAX_FEE | AUTO_FEE | number
|
36
|
-
* }
|
37
|
-
* });
|
38
|
-
* if (serializedTxn.error)
|
39
|
-
* // treat error here
|
40
|
-
*
|
41
|
-
* let signedTxn = await zkWorker.sign(signerAddress, serializedTxn);
|
42
|
-
* if (signedTxn.error)
|
43
|
-
* // treat error here
|
44
|
-
*
|
45
|
-
* let txnResult = await zkWorker.send(signedTxn) ;
|
46
|
-
* if (txnResult.error)
|
47
|
-
* // treat error here
|
48
|
-
* ~~~
|
49
|
-
*/
|
50
|
-
async prove(jobName, payload //: Promise < SerializedTxn > {
|
51
|
-
) { }
|
52
|
-
async sign(signerAddress, serializedTxn //: Promise<SignedSerializedTxn> {
|
53
|
-
) { }
|
54
|
-
async send(txn //: Promise<TxnResult> {
|
55
|
-
) { }
|
56
|
-
/**
|
57
|
-
* proveAndSend()
|
58
|
-
*
|
59
|
-
* The called cloud worker is expected to do all: compile the needed Contract,
|
60
|
-
* create the transaction, prove it, sign it using one of the available
|
61
|
-
* fee payers, and finally send it to MINA.
|
62
|
-
*
|
63
|
-
* IMPORTANT: the transaction fee will be paid by the first fee payer
|
64
|
-
* available from the list of fee payers provided by the ZKRunner service.
|
65
|
-
* Also the fee will be set by the cloud worker using some optimal algorithm
|
66
|
-
* that minimizes fees.
|
67
|
-
*
|
68
|
-
* In this case the sender public key to create and prove the transaction
|
69
|
-
* will be the selected ZKRunner fee payer previously mentioned.
|
70
|
-
*
|
71
|
-
* Example:
|
72
|
-
* ~~~
|
73
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
74
|
-
*
|
75
|
-
* let txnResult = await zkWorker.proveAndSend('batch-voting-...', {
|
76
|
-
* data: {
|
77
|
-
* claimUid: '012345...789',
|
78
|
-
* // ...
|
79
|
-
* }
|
80
|
-
* });
|
81
|
-
*
|
82
|
-
* if (txnResult.error)
|
83
|
-
* // treat error here
|
84
|
-
* ~~~
|
85
|
-
*/
|
86
|
-
async proveAndSend(jobName, payload //: Promise<TxnResult> {
|
87
|
-
) { }
|
88
|
-
/**
|
89
|
-
* runJob()
|
90
|
-
*
|
91
|
-
* The called cloud worker can also be used to easily run jobs not related to
|
92
|
-
* a MINA transaction, and will act just like any serverless function.
|
93
|
-
*
|
94
|
-
* This "generic" job can benefit from the easy to use deploy and call service
|
95
|
-
* already implemented for cloud proving without no extra costs.
|
96
|
-
*
|
97
|
-
* IMPORTANT: there will be a small fee that needs to be paid for service usage,
|
98
|
-
* but no MINA fees need to be paid.
|
99
|
-
*
|
100
|
-
* Example:
|
101
|
-
* ~~~
|
102
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
103
|
-
*
|
104
|
-
* let jobResult = await zkWorker.runJob('send-email-to-judges', {
|
105
|
-
* data: {
|
106
|
-
* judges: [
|
107
|
-
* // ...
|
108
|
-
* ],
|
109
|
-
* },
|
110
|
-
* options: {
|
111
|
-
* // ...
|
112
|
-
* }
|
113
|
-
* });
|
114
|
-
*
|
115
|
-
* if (txnResult.error)
|
116
|
-
* // treat error here
|
117
|
-
* ~~~
|
118
|
-
*/
|
119
|
-
async runJob(jobName, payload //: Promise<JobResult> {
|
120
|
-
) { }
|
121
|
-
}
|
122
|
-
exports.zkCloudWorkerAPI = zkCloudWorkerAPI;
|
@@ -1,147 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Client API for calling the zkCloudWorker
|
3
|
-
*/
|
4
|
-
export { TxnPayload, IsError, SerializedTxn, SignedSerializedTxn, TxnResult, JobPayload, JobResult, zkCloudWorkerAPI, };
|
5
|
-
interface TxnPayload {
|
6
|
-
data: object;
|
7
|
-
options?: object;
|
8
|
-
}
|
9
|
-
interface IsError {
|
10
|
-
code: number;
|
11
|
-
message: string;
|
12
|
-
exception: any;
|
13
|
-
}
|
14
|
-
interface SerializedTxn {
|
15
|
-
hash: string | null;
|
16
|
-
transaction: any | null;
|
17
|
-
error: IsError | null;
|
18
|
-
}
|
19
|
-
interface SignedSerializedTxn {
|
20
|
-
hash: string | null;
|
21
|
-
transaction: any | null;
|
22
|
-
error: IsError | null;
|
23
|
-
}
|
24
|
-
interface TxnResult {
|
25
|
-
hash: string | null;
|
26
|
-
data: any | null;
|
27
|
-
error: IsError | null;
|
28
|
-
}
|
29
|
-
interface JobPayload {
|
30
|
-
data: object;
|
31
|
-
options?: object;
|
32
|
-
}
|
33
|
-
interface JobResult {
|
34
|
-
data: any | null;
|
35
|
-
error: IsError | null;
|
36
|
-
}
|
37
|
-
declare class zkCloudWorkerAPI {
|
38
|
-
private API_KEY;
|
39
|
-
constructor(apiKey: string);
|
40
|
-
/**
|
41
|
-
* prove() sign() and send()
|
42
|
-
*
|
43
|
-
* The called cloud worker is expected to compile the needed Contract,
|
44
|
-
* create the transaction, prove it and send it back serialized.
|
45
|
-
*
|
46
|
-
* Then the serialized transaction can be signed locally using AuroWallet
|
47
|
-
* and finally send it to MINA using the cloud worker.
|
48
|
-
*
|
49
|
-
* IMPORTANT: the transaction fee will be paid by the local sender, using
|
50
|
-
* the Auro Wallet at the moment of signing the serialized transaction.
|
51
|
-
*
|
52
|
-
* We only need the sender public key to create and prove the transaction.
|
53
|
-
* The sender private key NEVER leaves the local wallet.
|
54
|
-
*
|
55
|
-
* Example:
|
56
|
-
* ~~~
|
57
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
58
|
-
*
|
59
|
-
* let serializedTxn = await zkWorker.prove('batch-voting-...', {
|
60
|
-
* data: {
|
61
|
-
* claimUid: '012345...789',
|
62
|
-
* // ...
|
63
|
-
* },
|
64
|
-
* options: {
|
65
|
-
* senderAddress: 'B62...',
|
66
|
-
* fee: MIN_FEE // MAX_FEE | AUTO_FEE | number
|
67
|
-
* }
|
68
|
-
* });
|
69
|
-
* if (serializedTxn.error)
|
70
|
-
* // treat error here
|
71
|
-
*
|
72
|
-
* let signedTxn = await zkWorker.sign(signerAddress, serializedTxn);
|
73
|
-
* if (signedTxn.error)
|
74
|
-
* // treat error here
|
75
|
-
*
|
76
|
-
* let txnResult = await zkWorker.send(signedTxn) ;
|
77
|
-
* if (txnResult.error)
|
78
|
-
* // treat error here
|
79
|
-
* ~~~
|
80
|
-
*/
|
81
|
-
prove(jobName: string, payload: TxnPayload): Promise<void>;
|
82
|
-
sign(signerAddress: string, serializedTxn: SerializedTxn): Promise<void>;
|
83
|
-
send(txn: SignedSerializedTxn): Promise<void>;
|
84
|
-
/**
|
85
|
-
* proveAndSend()
|
86
|
-
*
|
87
|
-
* The called cloud worker is expected to do all: compile the needed Contract,
|
88
|
-
* create the transaction, prove it, sign it using one of the available
|
89
|
-
* fee payers, and finally send it to MINA.
|
90
|
-
*
|
91
|
-
* IMPORTANT: the transaction fee will be paid by the first fee payer
|
92
|
-
* available from the list of fee payers provided by the ZKRunner service.
|
93
|
-
* Also the fee will be set by the cloud worker using some optimal algorithm
|
94
|
-
* that minimizes fees.
|
95
|
-
*
|
96
|
-
* In this case the sender public key to create and prove the transaction
|
97
|
-
* will be the selected ZKRunner fee payer previously mentioned.
|
98
|
-
*
|
99
|
-
* Example:
|
100
|
-
* ~~~
|
101
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
102
|
-
*
|
103
|
-
* let txnResult = await zkWorker.proveAndSend('batch-voting-...', {
|
104
|
-
* data: {
|
105
|
-
* claimUid: '012345...789',
|
106
|
-
* // ...
|
107
|
-
* }
|
108
|
-
* });
|
109
|
-
*
|
110
|
-
* if (txnResult.error)
|
111
|
-
* // treat error here
|
112
|
-
* ~~~
|
113
|
-
*/
|
114
|
-
proveAndSend(jobName: string, payload: TxnPayload): Promise<void>;
|
115
|
-
/**
|
116
|
-
* runJob()
|
117
|
-
*
|
118
|
-
* The called cloud worker can also be used to easily run jobs not related to
|
119
|
-
* a MINA transaction, and will act just like any serverless function.
|
120
|
-
*
|
121
|
-
* This "generic" job can benefit from the easy to use deploy and call service
|
122
|
-
* already implemented for cloud proving without no extra costs.
|
123
|
-
*
|
124
|
-
* IMPORTANT: there will be a small fee that needs to be paid for service usage,
|
125
|
-
* but no MINA fees need to be paid.
|
126
|
-
*
|
127
|
-
* Example:
|
128
|
-
* ~~~
|
129
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
130
|
-
*
|
131
|
-
* let jobResult = await zkWorker.runJob('send-email-to-judges', {
|
132
|
-
* data: {
|
133
|
-
* judges: [
|
134
|
-
* // ...
|
135
|
-
* ],
|
136
|
-
* },
|
137
|
-
* options: {
|
138
|
-
* // ...
|
139
|
-
* }
|
140
|
-
* });
|
141
|
-
*
|
142
|
-
* if (txnResult.error)
|
143
|
-
* // treat error here
|
144
|
-
* ~~~
|
145
|
-
*/
|
146
|
-
runJob(jobName: string, payload: JobPayload): Promise<void>;
|
147
|
-
}
|
@@ -1,134 +0,0 @@
|
|
1
|
-
import { __awaiter } from "tslib";
|
2
|
-
/**
|
3
|
-
* Client API for calling the zkCloudWorker
|
4
|
-
*/
|
5
|
-
export { zkCloudWorkerAPI, };
|
6
|
-
class zkCloudWorkerAPI {
|
7
|
-
constructor(apiKey) {
|
8
|
-
this.API_KEY = "";
|
9
|
-
this.API_KEY = apiKey;
|
10
|
-
}
|
11
|
-
/**
|
12
|
-
* prove() sign() and send()
|
13
|
-
*
|
14
|
-
* The called cloud worker is expected to compile the needed Contract,
|
15
|
-
* create the transaction, prove it and send it back serialized.
|
16
|
-
*
|
17
|
-
* Then the serialized transaction can be signed locally using AuroWallet
|
18
|
-
* and finally send it to MINA using the cloud worker.
|
19
|
-
*
|
20
|
-
* IMPORTANT: the transaction fee will be paid by the local sender, using
|
21
|
-
* the Auro Wallet at the moment of signing the serialized transaction.
|
22
|
-
*
|
23
|
-
* We only need the sender public key to create and prove the transaction.
|
24
|
-
* The sender private key NEVER leaves the local wallet.
|
25
|
-
*
|
26
|
-
* Example:
|
27
|
-
* ~~~
|
28
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
29
|
-
*
|
30
|
-
* let serializedTxn = await zkWorker.prove('batch-voting-...', {
|
31
|
-
* data: {
|
32
|
-
* claimUid: '012345...789',
|
33
|
-
* // ...
|
34
|
-
* },
|
35
|
-
* options: {
|
36
|
-
* senderAddress: 'B62...',
|
37
|
-
* fee: MIN_FEE // MAX_FEE | AUTO_FEE | number
|
38
|
-
* }
|
39
|
-
* });
|
40
|
-
* if (serializedTxn.error)
|
41
|
-
* // treat error here
|
42
|
-
*
|
43
|
-
* let signedTxn = await zkWorker.sign(signerAddress, serializedTxn);
|
44
|
-
* if (signedTxn.error)
|
45
|
-
* // treat error here
|
46
|
-
*
|
47
|
-
* let txnResult = await zkWorker.send(signedTxn) ;
|
48
|
-
* if (txnResult.error)
|
49
|
-
* // treat error here
|
50
|
-
* ~~~
|
51
|
-
*/
|
52
|
-
prove(jobName, payload //: Promise < SerializedTxn > {
|
53
|
-
) {
|
54
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
55
|
-
}
|
56
|
-
sign(signerAddress, serializedTxn //: Promise<SignedSerializedTxn> {
|
57
|
-
) {
|
58
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
59
|
-
}
|
60
|
-
send(txn //: Promise<TxnResult> {
|
61
|
-
) {
|
62
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
63
|
-
}
|
64
|
-
/**
|
65
|
-
* proveAndSend()
|
66
|
-
*
|
67
|
-
* The called cloud worker is expected to do all: compile the needed Contract,
|
68
|
-
* create the transaction, prove it, sign it using one of the available
|
69
|
-
* fee payers, and finally send it to MINA.
|
70
|
-
*
|
71
|
-
* IMPORTANT: the transaction fee will be paid by the first fee payer
|
72
|
-
* available from the list of fee payers provided by the ZKRunner service.
|
73
|
-
* Also the fee will be set by the cloud worker using some optimal algorithm
|
74
|
-
* that minimizes fees.
|
75
|
-
*
|
76
|
-
* In this case the sender public key to create and prove the transaction
|
77
|
-
* will be the selected ZKRunner fee payer previously mentioned.
|
78
|
-
*
|
79
|
-
* Example:
|
80
|
-
* ~~~
|
81
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
82
|
-
*
|
83
|
-
* let txnResult = await zkWorker.proveAndSend('batch-voting-...', {
|
84
|
-
* data: {
|
85
|
-
* claimUid: '012345...789',
|
86
|
-
* // ...
|
87
|
-
* }
|
88
|
-
* });
|
89
|
-
*
|
90
|
-
* if (txnResult.error)
|
91
|
-
* // treat error here
|
92
|
-
* ~~~
|
93
|
-
*/
|
94
|
-
proveAndSend(jobName, payload //: Promise<TxnResult> {
|
95
|
-
) {
|
96
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
97
|
-
}
|
98
|
-
/**
|
99
|
-
* runJob()
|
100
|
-
*
|
101
|
-
* The called cloud worker can also be used to easily run jobs not related to
|
102
|
-
* a MINA transaction, and will act just like any serverless function.
|
103
|
-
*
|
104
|
-
* This "generic" job can benefit from the easy to use deploy and call service
|
105
|
-
* already implemented for cloud proving without no extra costs.
|
106
|
-
*
|
107
|
-
* IMPORTANT: there will be a small fee that needs to be paid for service usage,
|
108
|
-
* but no MINA fees need to be paid.
|
109
|
-
*
|
110
|
-
* Example:
|
111
|
-
* ~~~
|
112
|
-
* let zkWorker = new ZKRunner(API_KEY);
|
113
|
-
*
|
114
|
-
* let jobResult = await zkWorker.runJob('send-email-to-judges', {
|
115
|
-
* data: {
|
116
|
-
* judges: [
|
117
|
-
* // ...
|
118
|
-
* ],
|
119
|
-
* },
|
120
|
-
* options: {
|
121
|
-
* // ...
|
122
|
-
* }
|
123
|
-
* });
|
124
|
-
*
|
125
|
-
* if (txnResult.error)
|
126
|
-
* // treat error here
|
127
|
-
* ~~~
|
128
|
-
*/
|
129
|
-
runJob(jobName, payload //: Promise<JobResult> {
|
130
|
-
) {
|
131
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
132
|
-
}
|
133
|
-
}
|
134
|
-
//# sourceMappingURL=client-api.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"client-api.js","sourceRoot":"","sources":["../../../../../src/api/client-api.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,EAQL,gBAAgB,GACjB,CAAC;AAyCF,MAAM,gBAAgB;IAGpB,YAAY,MAAc;QAFlB,YAAO,GAAW,EAAE,CAAC;QAG3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACG,KAAK,CACT,OAAe,EACf,OAAmB,CAAC,+BAA+B;;8DAClD,CAAC;KAAA;IAEE,IAAI,CACR,aAAqB,EACrB,aAA4B,CAAC,kCAAkC;;8DAC9D,CAAC;KAAA;IAEE,IAAI,CACR,GAAwB,CAAC,wBAAwB;;8DAChD,CAAC;KAAA;IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,YAAY,CAChB,OAAe,EACf,OAAmB,CAAC,wBAAwB;;8DAC3C,CAAC;KAAA;IAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,MAAM,CACV,OAAe,EACf,OAAmB,CAAC,wBAAwB;;8DAC3C,CAAC;KAAA;CACL"}
|
package/lib/web/src/fetch.js
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
import { __awaiter } from "tslib";
|
2
|
-
import { Mina, fetchAccount, checkZkappTransaction, } from "o1js";
|
3
|
-
import { sleep } from "./mina";
|
4
|
-
export function fetchMinaAccount(params) {
|
5
|
-
return __awaiter(this, void 0, void 0, function* () {
|
6
|
-
const { publicKey, tokenId, force } = params;
|
7
|
-
const timeout = 1000 * 60 * 10; // 10 minutes
|
8
|
-
const startTime = Date.now();
|
9
|
-
let result = { account: undefined };
|
10
|
-
while (Date.now() - startTime < timeout) {
|
11
|
-
try {
|
12
|
-
const result = yield fetchAccount({
|
13
|
-
publicKey,
|
14
|
-
tokenId,
|
15
|
-
});
|
16
|
-
return result;
|
17
|
-
}
|
18
|
-
catch (error) {
|
19
|
-
if (force === true)
|
20
|
-
console.log("Error in fetchAccount:", error);
|
21
|
-
else {
|
22
|
-
console.log("fetchMinaAccount error", typeof publicKey === "string" ? publicKey : publicKey.toBase58(), tokenId === null || tokenId === void 0 ? void 0 : tokenId.toString(), force, error);
|
23
|
-
return result;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
yield sleep(1000 * 10);
|
27
|
-
}
|
28
|
-
console.log("fetchMinaAccount timeout", typeof publicKey === "string" ? publicKey : publicKey.toBase58(), tokenId === null || tokenId === void 0 ? void 0 : tokenId.toString(), force);
|
29
|
-
return result;
|
30
|
-
});
|
31
|
-
}
|
32
|
-
export function fetchMinaActions(publicKey, fromActionState, endActionState) {
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
34
|
-
const timeout = 1000 * 60 * 600; // 10 hours
|
35
|
-
const startTime = Date.now();
|
36
|
-
while (Date.now() - startTime < timeout) {
|
37
|
-
try {
|
38
|
-
let actions = yield Mina.fetchActions(publicKey, {
|
39
|
-
fromActionState,
|
40
|
-
endActionState,
|
41
|
-
});
|
42
|
-
if (Array.isArray(actions))
|
43
|
-
return actions;
|
44
|
-
else
|
45
|
-
console.log("Cannot fetch actions - wrong format");
|
46
|
-
}
|
47
|
-
catch (error) {
|
48
|
-
console.log("Error in fetchMinaActions", error.toString().substring(0, 300));
|
49
|
-
}
|
50
|
-
yield sleep(1000 * 60 * 2);
|
51
|
-
}
|
52
|
-
console.log("Timeout in fetchMinaActions");
|
53
|
-
return undefined;
|
54
|
-
});
|
55
|
-
}
|
56
|
-
export function checkMinaZkappTransaction(hash) {
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
58
|
-
try {
|
59
|
-
const result = yield checkZkappTransaction(hash);
|
60
|
-
return result;
|
61
|
-
}
|
62
|
-
catch (error) {
|
63
|
-
console.error("Error in checkZkappTransaction:", error);
|
64
|
-
return { success: false };
|
65
|
-
}
|
66
|
-
});
|
67
|
-
}
|
68
|
-
//# sourceMappingURL=fetch.js.map
|
package/lib/web/src/fetch.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../src/fetch.ts"],"names":[],"mappings":";AAAA,OAAO,EAGL,IAAI,EACJ,YAAY,EACZ,qBAAqB,GACtB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,MAAM,UAAgB,gBAA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