zkcloudworker 0.12.1 → 0.14.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/lib/ts/src/cloud/worker/cloud.d.ts +2 -2
- package/lib/ts/src/mina/index.d.ts +2 -0
- package/lib/ts/src/mina/index.js +2 -0
- package/lib/ts/src/mina/local/local.d.ts +2 -2
- package/lib/ts/src/mina/local/local.js +8 -4
- package/lib/ts/src/mina/token/FungibleToken.d.ts +338 -0
- package/lib/ts/src/mina/token/FungibleToken.js +290 -0
- package/lib/ts/src/mina/token/FungibleTokenAdmin.d.ts +31 -0
- package/lib/ts/src/mina/token/FungibleTokenAdmin.js +102 -0
- package/lib/ts/src/mina/token/index.d.ts +2 -0
- package/lib/ts/src/mina/token/index.js +18 -0
- package/lib/ts/src/mina/transactions/blockberry.d.ts +16 -0
- package/lib/ts/src/mina/transactions/blockberry.js +80 -0
- package/lib/ts/src/mina/transactions/chain.d.ts +1 -0
- package/lib/ts/src/mina/transactions/chain.js +2 -0
- package/lib/ts/src/mina/transactions/index.d.ts +5 -0
- package/lib/ts/src/mina/transactions/index.js +21 -0
- package/lib/ts/src/mina/transactions/nonce.d.ts +10 -0
- package/lib/ts/src/mina/transactions/nonce.js +60 -0
- package/lib/ts/src/mina/transactions/transaction.d.ts +9 -0
- package/lib/ts/src/mina/transactions/transaction.js +69 -0
- package/lib/ts/src/mina/transactions/txstatus.d.ts +8 -0
- package/lib/ts/src/mina/transactions/txstatus.js +18 -0
- package/lib/ts/src/mina/utils/fetch.js +1 -1
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/cloud/worker/cloud.d.ts +2 -2
- package/lib/web/src/mina/index.d.ts +2 -0
- package/lib/web/src/mina/index.js +2 -0
- package/lib/web/src/mina/index.js.map +1 -1
- package/lib/web/src/mina/local/local.d.ts +2 -2
- package/lib/web/src/mina/local/local.js +8 -4
- package/lib/web/src/mina/local/local.js.map +1 -1
- package/lib/web/src/mina/token/FungibleToken.d.ts +338 -0
- package/lib/web/src/mina/token/FungibleToken.js +274 -0
- package/lib/web/src/mina/token/FungibleToken.js.map +1 -0
- package/lib/web/src/mina/token/FungibleTokenAdmin.d.ts +31 -0
- package/lib/web/src/mina/token/FungibleTokenAdmin.js +91 -0
- package/lib/web/src/mina/token/FungibleTokenAdmin.js.map +1 -0
- package/lib/web/src/mina/token/index.d.ts +2 -0
- package/lib/web/src/mina/token/index.js +3 -0
- package/lib/web/src/mina/token/index.js.map +1 -0
- package/lib/web/src/mina/transactions/blockberry.d.ts +16 -0
- package/lib/web/src/mina/transactions/blockberry.js +76 -0
- package/lib/web/src/mina/transactions/blockberry.js.map +1 -0
- package/lib/web/src/mina/transactions/chain.d.ts +1 -0
- package/lib/web/src/mina/transactions/chain.js +2 -0
- package/lib/web/src/mina/transactions/chain.js.map +1 -0
- package/lib/web/src/mina/transactions/index.d.ts +5 -0
- package/lib/web/src/mina/transactions/index.js +6 -0
- package/lib/web/src/mina/transactions/index.js.map +1 -0
- package/lib/web/src/mina/transactions/nonce.d.ts +10 -0
- package/lib/web/src/mina/transactions/nonce.js +58 -0
- package/lib/web/src/mina/transactions/nonce.js.map +1 -0
- package/lib/web/src/mina/transactions/transaction.d.ts +9 -0
- package/lib/web/src/mina/transactions/transaction.js +65 -0
- package/lib/web/src/mina/transactions/transaction.js.map +1 -0
- package/lib/web/src/mina/transactions/txstatus.d.ts +8 -0
- package/lib/web/src/mina/transactions/txstatus.js +16 -0
- package/lib/web/src/mina/transactions/txstatus.js.map +1 -0
- package/lib/web/src/mina/utils/fetch.js +1 -1
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +5 -5
@@ -129,7 +129,7 @@ export declare abstract class Cloud {
|
|
129
129
|
data: string;
|
130
130
|
context: string;
|
131
131
|
keyId?: string;
|
132
|
-
}): Promise<string>;
|
132
|
+
}): Promise<string | undefined>;
|
133
133
|
/**
|
134
134
|
* Abstract method to decrypt the data
|
135
135
|
* @param params
|
@@ -141,7 +141,7 @@ export declare abstract class Cloud {
|
|
141
141
|
data: string;
|
142
142
|
context: string;
|
143
143
|
keyId?: string;
|
144
|
-
}): Promise<string>;
|
144
|
+
}): Promise<string | undefined>;
|
145
145
|
/**
|
146
146
|
* Abstract method to calculate the recursive proof
|
147
147
|
* Used to calculate the recursive proof
|
package/lib/ts/src/mina/index.js
CHANGED
@@ -19,3 +19,5 @@ __exportStar(require("./encryption"), exports);
|
|
19
19
|
__exportStar(require("./utils"), exports);
|
20
20
|
__exportStar(require("./local/local"), exports);
|
21
21
|
__exportStar(require("./verification"), exports);
|
22
|
+
__exportStar(require("./token"), exports);
|
23
|
+
__exportStar(require("./transactions"), exports);
|
@@ -73,7 +73,7 @@ export declare class LocalCloud extends Cloud {
|
|
73
73
|
data: string;
|
74
74
|
context: string;
|
75
75
|
keyId?: string;
|
76
|
-
}): Promise<string>;
|
76
|
+
}): Promise<string | undefined>;
|
77
77
|
/**
|
78
78
|
* Decrypts the data
|
79
79
|
* @param params
|
@@ -86,7 +86,7 @@ export declare class LocalCloud extends Cloud {
|
|
86
86
|
data: string;
|
87
87
|
context: string;
|
88
88
|
keyId?: string;
|
89
|
-
}): Promise<string>;
|
89
|
+
}): Promise<string | undefined>;
|
90
90
|
/**
|
91
91
|
* Generates an id for local cloud
|
92
92
|
* @returns generated unique id
|
@@ -127,10 +127,14 @@ class LocalCloud extends cloud_1.Cloud {
|
|
127
127
|
*/
|
128
128
|
async decrypt(params) {
|
129
129
|
const { data, context, keyId } = JSON.parse(params.data);
|
130
|
-
if (context !== params.context)
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
if (context !== params.context) {
|
131
|
+
console.error("decrypt: context mismatch");
|
132
|
+
return undefined;
|
133
|
+
}
|
134
|
+
if (keyId !== params.keyId) {
|
135
|
+
console.error("decrypt: keyId mismatch");
|
136
|
+
return undefined;
|
137
|
+
}
|
134
138
|
return data;
|
135
139
|
}
|
136
140
|
/**
|
@@ -0,0 +1,338 @@
|
|
1
|
+
import { AccountUpdate, AccountUpdateForest, Bool, DeployArgs, Field, Int64, PublicKey, State, TokenContractV2, Types, UInt64, UInt8, VerificationKey } from "o1js";
|
2
|
+
import { FungibleTokenAdminBase } from "./FungibleTokenAdmin.js";
|
3
|
+
interface FungibleTokenDeployProps extends Exclude<DeployArgs, undefined> {
|
4
|
+
/** The token symbol. */
|
5
|
+
symbol: string;
|
6
|
+
/** A source code reference, which is placed within the `zkappUri` of the contract account.
|
7
|
+
* Typically a link to a file on github. */
|
8
|
+
src: string;
|
9
|
+
}
|
10
|
+
export declare const FungibleTokenErrors: {
|
11
|
+
noAdminKey: string;
|
12
|
+
noPermissionToChangeAdmin: string;
|
13
|
+
tokenPaused: string;
|
14
|
+
noPermissionToMint: string;
|
15
|
+
noPermissionToPause: string;
|
16
|
+
noPermissionToResume: string;
|
17
|
+
noTransferFromCirculation: string;
|
18
|
+
noPermissionChangeAllowed: string;
|
19
|
+
flashMinting: string;
|
20
|
+
unbalancedTransaction: string;
|
21
|
+
};
|
22
|
+
export declare class FungibleToken extends TokenContractV2 {
|
23
|
+
decimals: State<UInt8>;
|
24
|
+
admin: State<PublicKey>;
|
25
|
+
paused: State<import("o1js/dist/node/lib/provable/bool.js").Bool>;
|
26
|
+
static AdminContract: new (...args: any) => FungibleTokenAdminBase;
|
27
|
+
readonly events: {
|
28
|
+
SetAdmin: typeof SetAdminEvent;
|
29
|
+
Pause: typeof PauseEvent;
|
30
|
+
Mint: typeof MintEvent;
|
31
|
+
Burn: typeof BurnEvent;
|
32
|
+
BalanceChange: typeof BalanceChangeEvent;
|
33
|
+
};
|
34
|
+
deploy(props: FungibleTokenDeployProps): Promise<void>;
|
35
|
+
/** Update the verification key.
|
36
|
+
* Note that because we have set the permissions for setting the verification key to `impossibleDuringCurrentVersion()`, this will only be possible in case of a protocol update that requires an update.
|
37
|
+
*/
|
38
|
+
updateVerificationKey(vk: VerificationKey): Promise<void>;
|
39
|
+
/** Initializes the account for tracking total circulation.
|
40
|
+
* @argument {PublicKey} admin - public key where the admin contract is deployed
|
41
|
+
* @argument {UInt8} decimals - number of decimals for the token
|
42
|
+
* @argument {Bool} startPaused - if set to `Bool(true), the contract will start in a mode where token minting and transfers are paused. This should be used for non-atomic deployments
|
43
|
+
*/
|
44
|
+
initialize(admin: PublicKey, decimals: UInt8, startPaused: Bool): Promise<void>;
|
45
|
+
getAdminContract(): Promise<FungibleTokenAdminBase>;
|
46
|
+
setAdmin(admin: PublicKey): Promise<void>;
|
47
|
+
mint(recipient: PublicKey, amount: UInt64): Promise<AccountUpdate>;
|
48
|
+
burn(from: PublicKey, amount: UInt64): Promise<AccountUpdate>;
|
49
|
+
pause(): Promise<void>;
|
50
|
+
resume(): Promise<void>;
|
51
|
+
transfer(from: PublicKey, to: PublicKey, amount: UInt64): Promise<void>;
|
52
|
+
private checkPermissionsUpdate;
|
53
|
+
/** Approve `AccountUpdate`s that have been created outside of the token contract.
|
54
|
+
*
|
55
|
+
* @argument {AccountUpdateForest} updates - The `AccountUpdate`s to approve. Note that the forest size is limited by the base token contract, @see TokenContractV2.MAX_ACCOUNT_UPDATES The current limit is 9.
|
56
|
+
*/
|
57
|
+
approveBase(updates: AccountUpdateForest): Promise<void>;
|
58
|
+
getBalanceOf(address: PublicKey): Promise<UInt64>;
|
59
|
+
/** Reports the current circulating supply
|
60
|
+
* This does take into account currently unreduced actions.
|
61
|
+
*/
|
62
|
+
getCirculating(): Promise<UInt64>;
|
63
|
+
getDecimals(): Promise<UInt8>;
|
64
|
+
}
|
65
|
+
declare const SetAdminEvent_base: (new (value: {
|
66
|
+
adminKey: PublicKey;
|
67
|
+
}) => {
|
68
|
+
adminKey: PublicKey;
|
69
|
+
}) & {
|
70
|
+
_isStruct: true;
|
71
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
72
|
+
adminKey: PublicKey;
|
73
|
+
}, {
|
74
|
+
adminKey: {
|
75
|
+
x: bigint;
|
76
|
+
isOdd: boolean;
|
77
|
+
};
|
78
|
+
}>, "fromFields"> & {
|
79
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => {
|
80
|
+
adminKey: PublicKey;
|
81
|
+
};
|
82
|
+
} & {
|
83
|
+
fromValue: (value: {
|
84
|
+
adminKey: PublicKey | {
|
85
|
+
x: Field | bigint;
|
86
|
+
isOdd: Bool | boolean;
|
87
|
+
};
|
88
|
+
}) => {
|
89
|
+
adminKey: PublicKey;
|
90
|
+
};
|
91
|
+
toInput: (x: {
|
92
|
+
adminKey: PublicKey;
|
93
|
+
}) => {
|
94
|
+
fields?: Field[] | undefined;
|
95
|
+
packed?: [Field, number][] | undefined;
|
96
|
+
};
|
97
|
+
toJSON: (x: {
|
98
|
+
adminKey: PublicKey;
|
99
|
+
}) => {
|
100
|
+
adminKey: string;
|
101
|
+
};
|
102
|
+
fromJSON: (x: {
|
103
|
+
adminKey: string;
|
104
|
+
}) => {
|
105
|
+
adminKey: PublicKey;
|
106
|
+
};
|
107
|
+
empty: () => {
|
108
|
+
adminKey: PublicKey;
|
109
|
+
};
|
110
|
+
};
|
111
|
+
export declare class SetAdminEvent extends SetAdminEvent_base {
|
112
|
+
}
|
113
|
+
declare const PauseEvent_base: (new (value: {
|
114
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
115
|
+
}) => {
|
116
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
117
|
+
}) & {
|
118
|
+
_isStruct: true;
|
119
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
120
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
121
|
+
}, {
|
122
|
+
isPaused: boolean;
|
123
|
+
}>, "fromFields"> & {
|
124
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => {
|
125
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
126
|
+
};
|
127
|
+
} & {
|
128
|
+
fromValue: (value: {
|
129
|
+
isPaused: boolean | import("o1js/dist/node/lib/provable/bool.js").Bool;
|
130
|
+
}) => {
|
131
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
132
|
+
};
|
133
|
+
toInput: (x: {
|
134
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
135
|
+
}) => {
|
136
|
+
fields?: Field[] | undefined;
|
137
|
+
packed?: [Field, number][] | undefined;
|
138
|
+
};
|
139
|
+
toJSON: (x: {
|
140
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
141
|
+
}) => {
|
142
|
+
isPaused: boolean;
|
143
|
+
};
|
144
|
+
fromJSON: (x: {
|
145
|
+
isPaused: boolean;
|
146
|
+
}) => {
|
147
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
148
|
+
};
|
149
|
+
empty: () => {
|
150
|
+
isPaused: import("o1js/dist/node/lib/provable/bool.js").Bool;
|
151
|
+
};
|
152
|
+
};
|
153
|
+
export declare class PauseEvent extends PauseEvent_base {
|
154
|
+
}
|
155
|
+
declare const MintEvent_base: (new (value: {
|
156
|
+
recipient: PublicKey;
|
157
|
+
amount: Types.UInt64;
|
158
|
+
}) => {
|
159
|
+
recipient: PublicKey;
|
160
|
+
amount: Types.UInt64;
|
161
|
+
}) & {
|
162
|
+
_isStruct: true;
|
163
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
164
|
+
recipient: PublicKey;
|
165
|
+
amount: Types.UInt64;
|
166
|
+
}, {
|
167
|
+
recipient: {
|
168
|
+
x: bigint;
|
169
|
+
isOdd: boolean;
|
170
|
+
};
|
171
|
+
amount: bigint;
|
172
|
+
}>, "fromFields"> & {
|
173
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => {
|
174
|
+
recipient: PublicKey;
|
175
|
+
amount: Types.UInt64;
|
176
|
+
};
|
177
|
+
} & {
|
178
|
+
fromValue: (value: {
|
179
|
+
recipient: PublicKey | {
|
180
|
+
x: Field | bigint;
|
181
|
+
isOdd: Bool | boolean;
|
182
|
+
};
|
183
|
+
amount: bigint | Types.UInt64;
|
184
|
+
}) => {
|
185
|
+
recipient: PublicKey;
|
186
|
+
amount: Types.UInt64;
|
187
|
+
};
|
188
|
+
toInput: (x: {
|
189
|
+
recipient: PublicKey;
|
190
|
+
amount: Types.UInt64;
|
191
|
+
}) => {
|
192
|
+
fields?: Field[] | undefined;
|
193
|
+
packed?: [Field, number][] | undefined;
|
194
|
+
};
|
195
|
+
toJSON: (x: {
|
196
|
+
recipient: PublicKey;
|
197
|
+
amount: Types.UInt64;
|
198
|
+
}) => {
|
199
|
+
recipient: string;
|
200
|
+
amount: string;
|
201
|
+
};
|
202
|
+
fromJSON: (x: {
|
203
|
+
recipient: string;
|
204
|
+
amount: string;
|
205
|
+
}) => {
|
206
|
+
recipient: PublicKey;
|
207
|
+
amount: Types.UInt64;
|
208
|
+
};
|
209
|
+
empty: () => {
|
210
|
+
recipient: PublicKey;
|
211
|
+
amount: Types.UInt64;
|
212
|
+
};
|
213
|
+
};
|
214
|
+
export declare class MintEvent extends MintEvent_base {
|
215
|
+
}
|
216
|
+
declare const BurnEvent_base: (new (value: {
|
217
|
+
from: PublicKey;
|
218
|
+
amount: Types.UInt64;
|
219
|
+
}) => {
|
220
|
+
from: PublicKey;
|
221
|
+
amount: Types.UInt64;
|
222
|
+
}) & {
|
223
|
+
_isStruct: true;
|
224
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
225
|
+
from: PublicKey;
|
226
|
+
amount: Types.UInt64;
|
227
|
+
}, {
|
228
|
+
from: {
|
229
|
+
x: bigint;
|
230
|
+
isOdd: boolean;
|
231
|
+
};
|
232
|
+
amount: bigint;
|
233
|
+
}>, "fromFields"> & {
|
234
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => {
|
235
|
+
from: PublicKey;
|
236
|
+
amount: Types.UInt64;
|
237
|
+
};
|
238
|
+
} & {
|
239
|
+
fromValue: (value: {
|
240
|
+
from: PublicKey | {
|
241
|
+
x: Field | bigint;
|
242
|
+
isOdd: Bool | boolean;
|
243
|
+
};
|
244
|
+
amount: bigint | Types.UInt64;
|
245
|
+
}) => {
|
246
|
+
from: PublicKey;
|
247
|
+
amount: Types.UInt64;
|
248
|
+
};
|
249
|
+
toInput: (x: {
|
250
|
+
from: PublicKey;
|
251
|
+
amount: Types.UInt64;
|
252
|
+
}) => {
|
253
|
+
fields?: Field[] | undefined;
|
254
|
+
packed?: [Field, number][] | undefined;
|
255
|
+
};
|
256
|
+
toJSON: (x: {
|
257
|
+
from: PublicKey;
|
258
|
+
amount: Types.UInt64;
|
259
|
+
}) => {
|
260
|
+
from: string;
|
261
|
+
amount: string;
|
262
|
+
};
|
263
|
+
fromJSON: (x: {
|
264
|
+
from: string;
|
265
|
+
amount: string;
|
266
|
+
}) => {
|
267
|
+
from: PublicKey;
|
268
|
+
amount: Types.UInt64;
|
269
|
+
};
|
270
|
+
empty: () => {
|
271
|
+
from: PublicKey;
|
272
|
+
amount: Types.UInt64;
|
273
|
+
};
|
274
|
+
};
|
275
|
+
export declare class BurnEvent extends BurnEvent_base {
|
276
|
+
}
|
277
|
+
declare const BalanceChangeEvent_base: (new (value: {
|
278
|
+
address: PublicKey;
|
279
|
+
amount: Int64;
|
280
|
+
}) => {
|
281
|
+
address: PublicKey;
|
282
|
+
amount: Int64;
|
283
|
+
}) & {
|
284
|
+
_isStruct: true;
|
285
|
+
} & Omit<import("o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
|
286
|
+
address: PublicKey;
|
287
|
+
amount: Int64;
|
288
|
+
}, {
|
289
|
+
address: {
|
290
|
+
x: bigint;
|
291
|
+
isOdd: boolean;
|
292
|
+
};
|
293
|
+
amount: any;
|
294
|
+
}>, "fromFields"> & {
|
295
|
+
fromFields: (fields: import("o1js/dist/node/lib/provable/field.js").Field[]) => {
|
296
|
+
address: PublicKey;
|
297
|
+
amount: Int64;
|
298
|
+
};
|
299
|
+
} & {
|
300
|
+
fromValue: (value: {
|
301
|
+
address: PublicKey | {
|
302
|
+
x: Field | bigint;
|
303
|
+
isOdd: Bool | boolean;
|
304
|
+
};
|
305
|
+
amount: any;
|
306
|
+
}) => {
|
307
|
+
address: PublicKey;
|
308
|
+
amount: Int64;
|
309
|
+
};
|
310
|
+
toInput: (x: {
|
311
|
+
address: PublicKey;
|
312
|
+
amount: Int64;
|
313
|
+
}) => {
|
314
|
+
fields?: Field[] | undefined;
|
315
|
+
packed?: [Field, number][] | undefined;
|
316
|
+
};
|
317
|
+
toJSON: (x: {
|
318
|
+
address: PublicKey;
|
319
|
+
amount: Int64;
|
320
|
+
}) => {
|
321
|
+
address: string;
|
322
|
+
amount: any;
|
323
|
+
};
|
324
|
+
fromJSON: (x: {
|
325
|
+
address: string;
|
326
|
+
amount: any;
|
327
|
+
}) => {
|
328
|
+
address: PublicKey;
|
329
|
+
amount: Int64;
|
330
|
+
};
|
331
|
+
empty: () => {
|
332
|
+
address: PublicKey;
|
333
|
+
amount: Int64;
|
334
|
+
};
|
335
|
+
};
|
336
|
+
export declare class BalanceChangeEvent extends BalanceChangeEvent_base {
|
337
|
+
}
|
338
|
+
export {};
|