zkcloudworker 0.16.3 → 0.16.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/mina/index.d.ts +0 -2
- package/lib/ts/src/mina/index.js +0 -2
- package/lib/ts/src/mina/token/vk.d.ts +20 -0
- package/lib/ts/src/mina/token/vk.js +20 -0
- package/lib/ts/src/mina/utils/index.d.ts +2 -0
- package/lib/ts/src/mina/utils/index.js +2 -0
- package/lib/{web/src/mina/nft/whitelist.d.ts → ts/src/mina/utils/indexed-map.d.ts} +8 -7
- package/lib/ts/src/mina/{nft/whitelist.js → utils/indexed-map.js} +14 -18
- package/lib/ts/src/mina/utils/ipfs.d.ts +5 -0
- package/lib/ts/src/mina/utils/ipfs.js +10 -0
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/mina/index.d.ts +0 -2
- package/lib/web/src/mina/index.js +0 -2
- package/lib/web/src/mina/index.js.map +1 -1
- package/lib/web/src/mina/token/vk.d.ts +20 -0
- package/lib/web/src/mina/token/vk.js +20 -0
- package/lib/web/src/mina/token/vk.js.map +1 -1
- package/lib/web/src/mina/utils/index.d.ts +2 -0
- package/lib/web/src/mina/utils/index.js +2 -0
- package/lib/web/src/mina/utils/index.js.map +1 -1
- package/lib/{ts/src/mina/nft/whitelist.d.ts → web/src/mina/utils/indexed-map.d.ts} +8 -7
- package/lib/web/src/mina/{nft/whitelist.js → utils/indexed-map.js} +12 -14
- package/lib/web/src/mina/utils/indexed-map.js.map +1 -0
- package/lib/web/src/mina/utils/ipfs.d.ts +5 -0
- package/lib/web/src/mina/utils/ipfs.js +8 -0
- package/lib/web/src/mina/utils/ipfs.js.map +1 -0
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +2 -8
- package/lib/ts/src/mina/V1/FungibleToken.d.ts +0 -338
- package/lib/ts/src/mina/V1/FungibleToken.js +0 -308
- package/lib/ts/src/mina/V1/FungibleTokenAdmin.d.ts +0 -31
- package/lib/ts/src/mina/V1/FungibleTokenAdmin.js +0 -102
- package/lib/ts/src/mina/V1/index.d.ts +0 -28
- package/lib/ts/src/mina/V1/index.js +0 -13
- package/lib/ts/src/mina/V1/vk.d.ts +0 -22
- package/lib/ts/src/mina/V1/vk.js +0 -25
- package/lib/ts/src/mina/nft/index.d.ts +0 -3
- package/lib/ts/src/mina/nft/index.js +0 -19
- package/lib/ts/src/mina/nft/types.d.ts +0 -1254
- package/lib/ts/src/mina/nft/types.js +0 -236
- package/lib/ts/src/mina/nft/whitelist-admin.d.ts +0 -23
- package/lib/ts/src/mina/nft/whitelist-admin.js +0 -139
- package/lib/web/src/mina/V1/FungibleToken.d.ts +0 -338
- package/lib/web/src/mina/V1/FungibleToken.js +0 -292
- package/lib/web/src/mina/V1/FungibleToken.js.map +0 -1
- package/lib/web/src/mina/V1/FungibleTokenAdmin.d.ts +0 -31
- package/lib/web/src/mina/V1/FungibleTokenAdmin.js +0 -91
- package/lib/web/src/mina/V1/FungibleTokenAdmin.js.map +0 -1
- package/lib/web/src/mina/V1/index.d.ts +0 -28
- package/lib/web/src/mina/V1/index.js +0 -11
- package/lib/web/src/mina/V1/index.js.map +0 -1
- package/lib/web/src/mina/V1/vk.d.ts +0 -22
- package/lib/web/src/mina/V1/vk.js +0 -23
- package/lib/web/src/mina/V1/vk.js.map +0 -1
- package/lib/web/src/mina/nft/index.d.ts +0 -3
- package/lib/web/src/mina/nft/index.js +0 -4
- package/lib/web/src/mina/nft/index.js.map +0 -1
- package/lib/web/src/mina/nft/types.d.ts +0 -1254
- package/lib/web/src/mina/nft/types.js +0 -227
- package/lib/web/src/mina/nft/types.js.map +0 -1
- package/lib/web/src/mina/nft/whitelist-admin.d.ts +0 -23
- package/lib/web/src/mina/nft/whitelist-admin.js +0 -128
- package/lib/web/src/mina/nft/whitelist-admin.js.map +0 -1
- package/lib/web/src/mina/nft/whitelist.js.map +0 -1
@@ -1,236 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.NFTUpdateProof = exports.NFTImmutableState = exports.NFTState = exports.CollectionData = exports.NFTData = exports.MintSignatureData = exports.MintParams = exports.Storage = void 0;
|
4
|
-
const o1js_1 = require("o1js");
|
5
|
-
class Storage extends (0, o1js_1.Struct)({
|
6
|
-
url: o1js_1.Provable.Array(o1js_1.Field, 2),
|
7
|
-
}) {
|
8
|
-
constructor(value) {
|
9
|
-
super(value);
|
10
|
-
}
|
11
|
-
static assertEquals(a, b) {
|
12
|
-
a.url[0].assertEquals(b.url[0]);
|
13
|
-
a.url[1].assertEquals(b.url[1]);
|
14
|
-
}
|
15
|
-
static equals(a, b) {
|
16
|
-
return a.url[0].equals(b.url[0]).and(a.url[1].equals(b.url[1]));
|
17
|
-
}
|
18
|
-
static fromURL(url) {
|
19
|
-
const fields = o1js_1.Encoding.stringToFields(url);
|
20
|
-
if (fields.length !== 2)
|
21
|
-
throw new Error("Invalid URL");
|
22
|
-
return new Storage({ url: [fields[0], fields[1]] });
|
23
|
-
}
|
24
|
-
toURL() {
|
25
|
-
return o1js_1.Encoding.stringFromFields(this.url);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
exports.Storage = Storage;
|
29
|
-
class NFTImmutableState extends (0, o1js_1.Struct)({
|
30
|
-
creator: o1js_1.PublicKey, // readonly
|
31
|
-
canChangeOwner: o1js_1.Bool, // readonly
|
32
|
-
canChangeMetadata: o1js_1.Bool, // readonly
|
33
|
-
canChangePrice: o1js_1.Bool, // readonly
|
34
|
-
canChangeStorage: o1js_1.Bool, // readonly
|
35
|
-
canChangeName: o1js_1.Bool, // readonly
|
36
|
-
canChangeMetadataVerificationKeyHash: o1js_1.Bool, // readonly
|
37
|
-
canPause: o1js_1.Bool, // readonly
|
38
|
-
address: o1js_1.PublicKey, // readonly
|
39
|
-
tokenId: o1js_1.Field, // readonly
|
40
|
-
}) {
|
41
|
-
static assertEqual(a, b) {
|
42
|
-
a.creator.assertEquals(b.creator);
|
43
|
-
a.canChangeOwner.assertEquals(b.canChangeOwner);
|
44
|
-
a.canChangeMetadata.assertEquals(b.canChangeMetadata);
|
45
|
-
a.canChangePrice.assertEquals(b.canChangePrice);
|
46
|
-
a.canChangeStorage.assertEquals(b.canChangeStorage);
|
47
|
-
a.canChangeName.assertEquals(b.canChangeName);
|
48
|
-
a.canChangeMetadataVerificationKeyHash.assertEquals(b.canChangeMetadataVerificationKeyHash);
|
49
|
-
a.canPause.assertEquals(b.canPause);
|
50
|
-
a.address.assertEquals(b.address);
|
51
|
-
a.tokenId.assertEquals(b.tokenId);
|
52
|
-
}
|
53
|
-
}
|
54
|
-
exports.NFTImmutableState = NFTImmutableState;
|
55
|
-
class NFTState extends (0, o1js_1.Struct)({
|
56
|
-
immutableState: NFTImmutableState,
|
57
|
-
name: o1js_1.Field,
|
58
|
-
metadata: o1js_1.Field,
|
59
|
-
storage: Storage,
|
60
|
-
owner: o1js_1.PublicKey,
|
61
|
-
price: o1js_1.UInt64,
|
62
|
-
version: o1js_1.UInt32,
|
63
|
-
isPaused: o1js_1.Bool,
|
64
|
-
}) {
|
65
|
-
static assertEqual(a, b) {
|
66
|
-
NFTImmutableState.assertEqual(a.immutableState, b.immutableState);
|
67
|
-
a.name.assertEquals(b.name);
|
68
|
-
a.metadata.assertEquals(b.metadata);
|
69
|
-
Storage.assertEquals(a.storage, b.storage);
|
70
|
-
a.owner.assertEquals(b.owner);
|
71
|
-
a.price.assertEquals(b.price);
|
72
|
-
a.version.assertEquals(b.version);
|
73
|
-
a.isPaused.assertEquals(b.isPaused);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
exports.NFTState = NFTState;
|
77
|
-
class NFTUpdateProof extends o1js_1.DynamicProof {
|
78
|
-
}
|
79
|
-
exports.NFTUpdateProof = NFTUpdateProof;
|
80
|
-
NFTUpdateProof.publicInputType = NFTState;
|
81
|
-
NFTUpdateProof.publicOutputType = NFTState;
|
82
|
-
NFTUpdateProof.maxProofsVerified = 2;
|
83
|
-
NFTUpdateProof.featureFlags = o1js_1.FeatureFlags.allMaybe;
|
84
|
-
class NFTData extends (0, o1js_1.Struct)({
|
85
|
-
price: o1js_1.UInt64,
|
86
|
-
version: o1js_1.UInt32,
|
87
|
-
canChangeOwner: o1js_1.Bool, // readonly
|
88
|
-
canChangeMetadata: o1js_1.Bool, // readonly
|
89
|
-
canChangePrice: o1js_1.Bool, // readonly
|
90
|
-
canChangeStorage: o1js_1.Bool, // readonly
|
91
|
-
canChangeName: o1js_1.Bool, // readonly
|
92
|
-
canChangeMetadataVerificationKeyHash: o1js_1.Bool, // readonly
|
93
|
-
canPause: o1js_1.Bool, // readonly
|
94
|
-
isPaused: o1js_1.Bool,
|
95
|
-
// what else?
|
96
|
-
}) {
|
97
|
-
new(params = {}) {
|
98
|
-
const { price, version, canChangeOwner, canChangeMetadata, canChangePrice, canChangeStorage, canChangeName, canChangeMetadataVerificationKeyHash, canPause, isPaused, } = params;
|
99
|
-
return new NFTData({
|
100
|
-
price: o1js_1.UInt64.from(price ?? 0),
|
101
|
-
version: o1js_1.UInt32.from(version ?? 0),
|
102
|
-
canChangeOwner: (0, o1js_1.Bool)(canChangeOwner ?? true),
|
103
|
-
canChangeMetadata: (0, o1js_1.Bool)(canChangeMetadata ?? false),
|
104
|
-
canChangePrice: (0, o1js_1.Bool)(canChangePrice ?? true),
|
105
|
-
canChangeStorage: (0, o1js_1.Bool)(canChangeStorage ?? false),
|
106
|
-
canChangeName: (0, o1js_1.Bool)(canChangeName ?? false),
|
107
|
-
canChangeMetadataVerificationKeyHash: (0, o1js_1.Bool)(canChangeMetadataVerificationKeyHash ?? false),
|
108
|
-
canPause: (0, o1js_1.Bool)(canPause ?? false),
|
109
|
-
isPaused: (0, o1js_1.Bool)(isPaused ?? false),
|
110
|
-
});
|
111
|
-
}
|
112
|
-
pack() {
|
113
|
-
const price = this.price.value.toBits(64);
|
114
|
-
const version = this.version.value.toBits(32);
|
115
|
-
return o1js_1.Field.fromBits([
|
116
|
-
...price,
|
117
|
-
...version,
|
118
|
-
this.canChangeOwner,
|
119
|
-
this.canChangeMetadata,
|
120
|
-
this.canChangePrice,
|
121
|
-
this.canChangeStorage,
|
122
|
-
this.canChangeName,
|
123
|
-
this.canChangeMetadataVerificationKeyHash,
|
124
|
-
this.canPause,
|
125
|
-
this.isPaused,
|
126
|
-
]);
|
127
|
-
}
|
128
|
-
static unpack(packed) {
|
129
|
-
const bits = packed.toBits(64 + 32 + 8);
|
130
|
-
const price = o1js_1.UInt64.Unsafe.fromField(o1js_1.Field.fromBits(bits.slice(0, 64)));
|
131
|
-
const version = o1js_1.UInt32.Unsafe.fromField(o1js_1.Field.fromBits(bits.slice(64, 64 + 32)));
|
132
|
-
const canChangeOwner = bits[64 + 32];
|
133
|
-
const canChangeMetadata = bits[64 + 32 + 1];
|
134
|
-
const canChangePrice = bits[64 + 32 + 2];
|
135
|
-
const canChangeStorage = bits[64 + 32 + 3];
|
136
|
-
const canChangeName = bits[64 + 32 + 4];
|
137
|
-
const canChangeMetadataVerificationKeyHash = bits[64 + 32 + 5];
|
138
|
-
const canPause = bits[64 + 32 + 6];
|
139
|
-
const isPaused = bits[64 + 32 + 7];
|
140
|
-
return new NFTData({
|
141
|
-
price,
|
142
|
-
version,
|
143
|
-
canChangeOwner,
|
144
|
-
canChangeMetadata,
|
145
|
-
canChangePrice,
|
146
|
-
canChangeStorage,
|
147
|
-
canChangeName,
|
148
|
-
canChangeMetadataVerificationKeyHash,
|
149
|
-
canPause,
|
150
|
-
isPaused,
|
151
|
-
});
|
152
|
-
}
|
153
|
-
}
|
154
|
-
exports.NFTData = NFTData;
|
155
|
-
class CollectionData extends (0, o1js_1.Struct)({
|
156
|
-
requireTransferApproval: o1js_1.Bool,
|
157
|
-
requireUpdateApproval: o1js_1.Bool,
|
158
|
-
requireSaleApproval: o1js_1.Bool,
|
159
|
-
requireBuyApproval: o1js_1.Bool,
|
160
|
-
requireMintApproval: o1js_1.Bool,
|
161
|
-
canMint: o1js_1.Bool,
|
162
|
-
canPause: o1js_1.Bool,
|
163
|
-
canResume: o1js_1.Bool,
|
164
|
-
canChangeName: o1js_1.Bool,
|
165
|
-
canChangeCreator: o1js_1.Bool,
|
166
|
-
canChangeBaseUri: o1js_1.Bool,
|
167
|
-
canChangeSaleCommission: o1js_1.Bool,
|
168
|
-
isPaused: o1js_1.Bool,
|
169
|
-
}) {
|
170
|
-
pack() {
|
171
|
-
return o1js_1.Field.fromBits([
|
172
|
-
this.requireTransferApproval,
|
173
|
-
this.requireUpdateApproval,
|
174
|
-
this.requireSaleApproval,
|
175
|
-
this.requireMintApproval,
|
176
|
-
this.requireBuyApproval,
|
177
|
-
this.canMint,
|
178
|
-
this.canChangeName,
|
179
|
-
this.canChangeCreator,
|
180
|
-
this.canChangeBaseUri,
|
181
|
-
this.canChangeSaleCommission,
|
182
|
-
this.canPause,
|
183
|
-
this.canResume,
|
184
|
-
this.isPaused,
|
185
|
-
]);
|
186
|
-
}
|
187
|
-
static unpack(packed) {
|
188
|
-
const bits = packed.toBits(13);
|
189
|
-
return new CollectionData({
|
190
|
-
requireTransferApproval: bits[0],
|
191
|
-
requireUpdateApproval: bits[1],
|
192
|
-
requireSaleApproval: bits[2],
|
193
|
-
requireMintApproval: bits[3],
|
194
|
-
requireBuyApproval: bits[4],
|
195
|
-
canMint: bits[5],
|
196
|
-
canChangeName: bits[6],
|
197
|
-
canChangeCreator: bits[7],
|
198
|
-
canChangeBaseUri: bits[8],
|
199
|
-
canChangeSaleCommission: bits[9],
|
200
|
-
canPause: bits[10],
|
201
|
-
canResume: bits[11],
|
202
|
-
isPaused: bits[12],
|
203
|
-
});
|
204
|
-
}
|
205
|
-
}
|
206
|
-
exports.CollectionData = CollectionData;
|
207
|
-
class MintParams extends (0, o1js_1.Struct)({
|
208
|
-
name: o1js_1.Field,
|
209
|
-
address: o1js_1.PublicKey,
|
210
|
-
tokenId: o1js_1.Field,
|
211
|
-
owner: o1js_1.PublicKey,
|
212
|
-
data: NFTData,
|
213
|
-
fee: o1js_1.UInt64,
|
214
|
-
metadata: o1js_1.Field,
|
215
|
-
storage: Storage,
|
216
|
-
metadataVerificationKey: o1js_1.VerificationKey,
|
217
|
-
nftVerificationKey: o1js_1.VerificationKey,
|
218
|
-
expiry: o1js_1.UInt32,
|
219
|
-
}) {
|
220
|
-
}
|
221
|
-
exports.MintParams = MintParams;
|
222
|
-
class MintSignatureData extends (0, o1js_1.Struct)({
|
223
|
-
name: o1js_1.Field,
|
224
|
-
address: o1js_1.PublicKey,
|
225
|
-
tokenId: o1js_1.Field,
|
226
|
-
owner: o1js_1.PublicKey,
|
227
|
-
packedData: o1js_1.Field,
|
228
|
-
fee: o1js_1.UInt64,
|
229
|
-
metadata: o1js_1.Field,
|
230
|
-
storage: Storage,
|
231
|
-
metadataVerificationKeyHash: o1js_1.Field,
|
232
|
-
nftVerificationKeyHash: o1js_1.Field,
|
233
|
-
expiry: o1js_1.UInt32,
|
234
|
-
}) {
|
235
|
-
}
|
236
|
-
exports.MintSignatureData = MintSignatureData;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { DeployArgs, PublicKey, SmartContract, State, VerificationKey, UInt64, Field } from "o1js";
|
2
|
-
import { MintParams, NFTState, NFTAdminBase, Storage } from "./types";
|
3
|
-
export interface NFTWhitelistedAdminDeployProps extends Exclude<DeployArgs, undefined> {
|
4
|
-
admin: PublicKey;
|
5
|
-
collection: PublicKey;
|
6
|
-
whitelist: Field;
|
7
|
-
storage: Storage;
|
8
|
-
}
|
9
|
-
export declare class NFTWhitelistedAdmin extends SmartContract implements NFTAdminBase {
|
10
|
-
collection: State<PublicKey>;
|
11
|
-
admin: State<PublicKey>;
|
12
|
-
whitelist: State<import("o1js/dist/node/lib/provable/field").Field>;
|
13
|
-
storage: State<Storage>;
|
14
|
-
deploy(props: NFTWhitelistedAdminDeployProps): Promise<void>;
|
15
|
-
isWhitelisted(address: PublicKey, amount: UInt64): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
16
|
-
updateVerificationKey(vk: VerificationKey): Promise<void>;
|
17
|
-
canMint(params: MintParams): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
18
|
-
canUpdate(input: NFTState, output: NFTState): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
19
|
-
canTransfer(address: PublicKey, from: PublicKey, to: PublicKey): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
20
|
-
canSell(address: PublicKey, seller: PublicKey, price: UInt64): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
21
|
-
canBuy(address: PublicKey, seller: PublicKey, buyer: PublicKey, price: UInt64): Promise<import("o1js/dist/node/lib/provable/bool").Bool>;
|
22
|
-
updateMerkleMapRoot(root: Field, storage: Storage): Promise<void>;
|
23
|
-
}
|
@@ -1,139 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.NFTWhitelistedAdmin = void 0;
|
13
|
-
const o1js_1 = require("o1js");
|
14
|
-
const whitelist_1 = require("./whitelist");
|
15
|
-
const types_1 = require("./types");
|
16
|
-
class NFTWhitelistedAdmin extends o1js_1.SmartContract {
|
17
|
-
constructor() {
|
18
|
-
super(...arguments);
|
19
|
-
this.collection = (0, o1js_1.State)();
|
20
|
-
this.admin = (0, o1js_1.State)();
|
21
|
-
this.whitelist = (0, o1js_1.State)();
|
22
|
-
this.storage = (0, o1js_1.State)();
|
23
|
-
}
|
24
|
-
async deploy(props) {
|
25
|
-
await super.deploy(props);
|
26
|
-
this.collection.set(props.collection);
|
27
|
-
this.admin.set(props.admin);
|
28
|
-
this.whitelist.set(props.whitelist);
|
29
|
-
this.storage.set(props.storage);
|
30
|
-
this.account.zkappUri.set("zkcloudworker#NFTWhitelistedAdmin");
|
31
|
-
this.account.permissions.set({
|
32
|
-
...o1js_1.Permissions.default(),
|
33
|
-
setVerificationKey: o1js_1.Permissions.VerificationKey.impossibleDuringCurrentVersion(),
|
34
|
-
setPermissions: o1js_1.Permissions.impossible(),
|
35
|
-
});
|
36
|
-
}
|
37
|
-
async isWhitelisted(address, amount) {
|
38
|
-
const whitelist = this.whitelist.getAndRequireEquals();
|
39
|
-
const storage = this.storage.getAndRequireEquals();
|
40
|
-
const map = await o1js_1.Provable.witnessAsync(whitelist_1.Whitelist, async () => {
|
41
|
-
return await (0, whitelist_1.loadWhitelist)(storage);
|
42
|
-
});
|
43
|
-
map.root.assertEquals(whitelist);
|
44
|
-
const key = o1js_1.Poseidon.hash(address.toFields());
|
45
|
-
map.assertIncluded(key, "Address not whitelisted");
|
46
|
-
const value = map.get(key);
|
47
|
-
value.assertLessThanOrEqual((0, o1js_1.Field)(o1js_1.UInt64.MAXINT().value));
|
48
|
-
const maxAmount = o1js_1.UInt64.Unsafe.fromField(value);
|
49
|
-
return (0, o1js_1.Bool)(amount.lessThanOrEqual(maxAmount));
|
50
|
-
}
|
51
|
-
async updateVerificationKey(vk) {
|
52
|
-
const sender = this.sender.getAndRequireSignature();
|
53
|
-
this.admin.getAndRequireEquals().assertEquals(sender);
|
54
|
-
this.account.verificationKey.set(vk);
|
55
|
-
}
|
56
|
-
async canMint(params) {
|
57
|
-
return await this.isWhitelisted(params.owner, o1js_1.UInt64.from(0));
|
58
|
-
}
|
59
|
-
async canUpdate(input, output) {
|
60
|
-
return await this.isWhitelisted(output.owner, o1js_1.UInt64.from(0));
|
61
|
-
}
|
62
|
-
async canTransfer(address, from, to) {
|
63
|
-
return await this.isWhitelisted(to, o1js_1.UInt64.from(0));
|
64
|
-
}
|
65
|
-
async canSell(address, seller, price) {
|
66
|
-
return await this.isWhitelisted(address, price);
|
67
|
-
}
|
68
|
-
async canBuy(address, seller, buyer, price) {
|
69
|
-
return (await this.isWhitelisted(buyer, price)).and(await this.isWhitelisted(seller, price));
|
70
|
-
}
|
71
|
-
async updateMerkleMapRoot(root, storage) {
|
72
|
-
const sender = this.sender.getAndRequireSignature();
|
73
|
-
this.admin.getAndRequireEquals().assertEquals(sender);
|
74
|
-
this.whitelist.set(root);
|
75
|
-
this.storage.set(storage);
|
76
|
-
}
|
77
|
-
}
|
78
|
-
exports.NFTWhitelistedAdmin = NFTWhitelistedAdmin;
|
79
|
-
__decorate([
|
80
|
-
(0, o1js_1.state)(o1js_1.PublicKey),
|
81
|
-
__metadata("design:type", Object)
|
82
|
-
], NFTWhitelistedAdmin.prototype, "collection", void 0);
|
83
|
-
__decorate([
|
84
|
-
(0, o1js_1.state)(o1js_1.PublicKey),
|
85
|
-
__metadata("design:type", Object)
|
86
|
-
], NFTWhitelistedAdmin.prototype, "admin", void 0);
|
87
|
-
__decorate([
|
88
|
-
(0, o1js_1.state)(o1js_1.Field),
|
89
|
-
__metadata("design:type", Object)
|
90
|
-
], NFTWhitelistedAdmin.prototype, "whitelist", void 0);
|
91
|
-
__decorate([
|
92
|
-
(0, o1js_1.state)(types_1.Storage),
|
93
|
-
__metadata("design:type", Object)
|
94
|
-
], NFTWhitelistedAdmin.prototype, "storage", void 0);
|
95
|
-
__decorate([
|
96
|
-
o1js_1.method,
|
97
|
-
__metadata("design:type", Function),
|
98
|
-
__metadata("design:paramtypes", [o1js_1.VerificationKey]),
|
99
|
-
__metadata("design:returntype", Promise)
|
100
|
-
], NFTWhitelistedAdmin.prototype, "updateVerificationKey", null);
|
101
|
-
__decorate([
|
102
|
-
o1js_1.method.returns(o1js_1.Bool),
|
103
|
-
__metadata("design:type", Function),
|
104
|
-
__metadata("design:paramtypes", [types_1.MintParams]),
|
105
|
-
__metadata("design:returntype", Promise)
|
106
|
-
], NFTWhitelistedAdmin.prototype, "canMint", null);
|
107
|
-
__decorate([
|
108
|
-
o1js_1.method.returns(o1js_1.Bool),
|
109
|
-
__metadata("design:type", Function),
|
110
|
-
__metadata("design:paramtypes", [types_1.NFTState, types_1.NFTState]),
|
111
|
-
__metadata("design:returntype", Promise)
|
112
|
-
], NFTWhitelistedAdmin.prototype, "canUpdate", null);
|
113
|
-
__decorate([
|
114
|
-
o1js_1.method.returns(o1js_1.Bool),
|
115
|
-
__metadata("design:type", Function),
|
116
|
-
__metadata("design:paramtypes", [o1js_1.PublicKey, o1js_1.PublicKey, o1js_1.PublicKey]),
|
117
|
-
__metadata("design:returntype", Promise)
|
118
|
-
], NFTWhitelistedAdmin.prototype, "canTransfer", null);
|
119
|
-
__decorate([
|
120
|
-
o1js_1.method.returns(o1js_1.Bool),
|
121
|
-
__metadata("design:type", Function),
|
122
|
-
__metadata("design:paramtypes", [o1js_1.PublicKey, o1js_1.PublicKey, o1js_1.UInt64]),
|
123
|
-
__metadata("design:returntype", Promise)
|
124
|
-
], NFTWhitelistedAdmin.prototype, "canSell", null);
|
125
|
-
__decorate([
|
126
|
-
o1js_1.method.returns(o1js_1.Bool),
|
127
|
-
__metadata("design:type", Function),
|
128
|
-
__metadata("design:paramtypes", [o1js_1.PublicKey,
|
129
|
-
o1js_1.PublicKey,
|
130
|
-
o1js_1.PublicKey,
|
131
|
-
o1js_1.UInt64]),
|
132
|
-
__metadata("design:returntype", Promise)
|
133
|
-
], NFTWhitelistedAdmin.prototype, "canBuy", null);
|
134
|
-
__decorate([
|
135
|
-
o1js_1.method,
|
136
|
-
__metadata("design:type", Function),
|
137
|
-
__metadata("design:paramtypes", [o1js_1.Field, types_1.Storage]),
|
138
|
-
__metadata("design:returntype", Promise)
|
139
|
-
], NFTWhitelistedAdmin.prototype, "updateMerkleMapRoot", null);
|