oneie 3.6.39 → 3.6.40
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/.claude/commands/deploy.md +187 -17
- package/.claude/commands/media-upload.md +186 -0
- package/.claude/hooks/.last-news-context +1 -1
- package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
- package/one/README.md +1 -2
- package/one/knowledge/one-protocol-ai-agents.md +892 -0
- package/one/knowledge/one-protocol-executive-report.md +617 -0
- package/one/knowledge/one-protocol-standard.md +869 -0
- package/one/knowledge/one-protocol-whitepaper.md +756 -0
- package/one/knowledge/ontology-education-game.md +1654 -0
- package/one/knowledge/ontology-v2.md +4449 -0
- package/one/knowledge/ontology.md +1 -1
- package/one/things/contracts/Move.toml +12 -0
- package/one/things/contracts/README.md +288 -0
- package/one/things/contracts/one.move +762 -0
- package/one/things/contracts/sdk.ts +578 -0
- package/one/things/crypto/FEATURES.md +78 -0
- package/one/things/crypto/ONECORE.md +62 -0
- package/one/things/crypto/ONECOREFAQ.md +22 -0
- package/one/things/crypto/ONECOREHOW.md +46 -0
- package/one/things/crypto/ONEENTERPRISE.md +64 -0
- package/one/things/crypto/ONEENTERPRISEFAQ.md +64 -0
- package/one/things/crypto/ONEENTERPRISEHOW.md +53 -0
- package/one/things/crypto/ONEPRO.md +60 -0
- package/one/things/crypto/ONEPROFAQ.md +22 -0
- package/one/things/crypto/ONEPROHOW.md +53 -0
- package/one/things/crypto/READMEAGENCY.md +64 -0
- package/one/things/crypto/VSL.md +45 -0
- package/one/things/crypto/WebsiteCopy.md +176 -0
- package/one/things/design-system.md +832 -0
- package/one/things/pay.one.ie.md +53 -0
- package/one/things/plans/one-protocol-and-payone-usage.md +82 -0
- package/one/things/plans/plan-connect-to-api.md +146 -0
- package/one/things/plans-u.md +905 -0
- package/one/things/products/Blockchain Products.md +6278 -0
- package/one/things/scripts-clean-mac.sh +409 -0
- package/one/things/todo-release.md +654 -0
- package/one/things/todo.md +9 -642
- package/one/things/video-script-backup.md +318 -0
- package/one/things/video-script-demo.md +382 -0
- package/one/things/video-script-ontology.md +0 -1
- package/one/things/video-script.md +361 -0
- package/package.json +6 -5
- package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-311.pyc +0 -0
- package/llms.txt +0 -257
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE Contract SDK
|
|
3
|
+
*
|
|
4
|
+
* TypeScript SDK for interacting with the ONE Universal Smart Contract on Sui.
|
|
5
|
+
* This integrates with the ONE Platform's ontology and Effect.ts patterns.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Effect, Context, Layer } from "effect";
|
|
9
|
+
import { SuiClient, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
10
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
11
|
+
|
|
12
|
+
// ============================================================
|
|
13
|
+
// ENTITY TYPES - Must match Move constants
|
|
14
|
+
// ============================================================
|
|
15
|
+
|
|
16
|
+
export const EntityType = {
|
|
17
|
+
PRODUCT: 1,
|
|
18
|
+
SUBSCRIPTION: 2,
|
|
19
|
+
LESSON: 3,
|
|
20
|
+
MEMBERSHIP: 4,
|
|
21
|
+
CREDENTIAL: 5,
|
|
22
|
+
TOKEN: 6,
|
|
23
|
+
NFT: 7,
|
|
24
|
+
ACCESS_PASS: 8,
|
|
25
|
+
EVENT_TICKET: 9,
|
|
26
|
+
DIGITAL_GOOD: 10,
|
|
27
|
+
SERVICE: 11,
|
|
28
|
+
LICENSE: 12,
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export type EntityTypeValue = (typeof EntityType)[keyof typeof EntityType];
|
|
32
|
+
|
|
33
|
+
// ============================================================
|
|
34
|
+
// TYPES
|
|
35
|
+
// ============================================================
|
|
36
|
+
|
|
37
|
+
export interface ONEContractConfig {
|
|
38
|
+
packageId: string;
|
|
39
|
+
registryId: string;
|
|
40
|
+
network: "mainnet" | "testnet" | "devnet";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CreateMerchantParams {
|
|
44
|
+
name: string;
|
|
45
|
+
metadata: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface CreateEntityParams {
|
|
49
|
+
merchantId: string;
|
|
50
|
+
entityType: EntityTypeValue;
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
price: bigint; // in MIST (1 SUI = 1_000_000_000 MIST)
|
|
54
|
+
maxSupply: bigint; // 0 = unlimited
|
|
55
|
+
metadata: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PurchaseEntityParams {
|
|
59
|
+
merchantId: string;
|
|
60
|
+
entityId: string;
|
|
61
|
+
paymentCoinId: string;
|
|
62
|
+
expiresInMs: bigint; // 0 = permanent, >0 = subscription duration
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ListForSaleParams {
|
|
66
|
+
ownershipId: string;
|
|
67
|
+
price: bigint;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface Merchant {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
wallet: string;
|
|
74
|
+
totalSales: bigint;
|
|
75
|
+
entityCount: bigint;
|
|
76
|
+
isActive: boolean;
|
|
77
|
+
metadata: Record<string, unknown>;
|
|
78
|
+
createdAt: bigint;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface Entity {
|
|
82
|
+
id: string;
|
|
83
|
+
entityType: EntityTypeValue;
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
price: bigint;
|
|
87
|
+
merchantId: string;
|
|
88
|
+
isActive: boolean;
|
|
89
|
+
maxSupply: bigint;
|
|
90
|
+
currentSupply: bigint;
|
|
91
|
+
metadata: Record<string, unknown>;
|
|
92
|
+
createdAt: bigint;
|
|
93
|
+
updatedAt: bigint;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface Ownership {
|
|
97
|
+
id: string;
|
|
98
|
+
entityId: string;
|
|
99
|
+
entityType: EntityTypeValue;
|
|
100
|
+
entityName: string;
|
|
101
|
+
owner: string;
|
|
102
|
+
acquiredAt: bigint;
|
|
103
|
+
expiresAt: bigint;
|
|
104
|
+
pricePaid: bigint;
|
|
105
|
+
metadata: Record<string, unknown>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ============================================================
|
|
109
|
+
// ERRORS
|
|
110
|
+
// ============================================================
|
|
111
|
+
|
|
112
|
+
export class ONEContractError extends Error {
|
|
113
|
+
constructor(
|
|
114
|
+
message: string,
|
|
115
|
+
public readonly code: string
|
|
116
|
+
) {
|
|
117
|
+
super(message);
|
|
118
|
+
this.name = "ONEContractError";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ============================================================
|
|
123
|
+
// SERVICE - Effect.ts Pattern
|
|
124
|
+
// ============================================================
|
|
125
|
+
|
|
126
|
+
export interface ONEContractService {
|
|
127
|
+
readonly config: ONEContractConfig;
|
|
128
|
+
|
|
129
|
+
// Merchant operations
|
|
130
|
+
registerMerchant: (
|
|
131
|
+
params: CreateMerchantParams
|
|
132
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
133
|
+
|
|
134
|
+
getMerchant: (
|
|
135
|
+
merchantId: string
|
|
136
|
+
) => Effect.Effect<Merchant, ONEContractError>;
|
|
137
|
+
|
|
138
|
+
// Entity operations
|
|
139
|
+
createEntity: (
|
|
140
|
+
params: CreateEntityParams
|
|
141
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
142
|
+
|
|
143
|
+
getEntity: (
|
|
144
|
+
entityId: string
|
|
145
|
+
) => Effect.Effect<Entity, ONEContractError>;
|
|
146
|
+
|
|
147
|
+
purchaseEntity: (
|
|
148
|
+
params: PurchaseEntityParams
|
|
149
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
150
|
+
|
|
151
|
+
// Ownership operations
|
|
152
|
+
getOwnerships: (
|
|
153
|
+
owner: string
|
|
154
|
+
) => Effect.Effect<Ownership[], ONEContractError>;
|
|
155
|
+
|
|
156
|
+
isOwnershipValid: (
|
|
157
|
+
ownershipId: string
|
|
158
|
+
) => Effect.Effect<boolean, ONEContractError>;
|
|
159
|
+
|
|
160
|
+
// Market operations
|
|
161
|
+
listForSale: (
|
|
162
|
+
params: ListForSaleParams
|
|
163
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
164
|
+
|
|
165
|
+
// Convenience methods
|
|
166
|
+
createProduct: (
|
|
167
|
+
params: Omit<CreateEntityParams, "entityType">
|
|
168
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
169
|
+
|
|
170
|
+
createSubscription: (
|
|
171
|
+
params: Omit<CreateEntityParams, "entityType">
|
|
172
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
173
|
+
|
|
174
|
+
createLesson: (
|
|
175
|
+
params: Omit<CreateEntityParams, "entityType">
|
|
176
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
177
|
+
|
|
178
|
+
createEventTicket: (
|
|
179
|
+
params: Omit<CreateEntityParams, "entityType">
|
|
180
|
+
) => Effect.Effect<SuiTransactionBlockResponse, ONEContractError>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const ONEContractService = Context.GenericTag<ONEContractService>(
|
|
184
|
+
"ONEContractService"
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
// ============================================================
|
|
188
|
+
// IMPLEMENTATION
|
|
189
|
+
// ============================================================
|
|
190
|
+
|
|
191
|
+
const makeONEContractService = (
|
|
192
|
+
suiClient: SuiClient,
|
|
193
|
+
config: ONEContractConfig,
|
|
194
|
+
signer: { signAndExecuteTransaction: (tx: Transaction) => Promise<SuiTransactionBlockResponse> }
|
|
195
|
+
): ONEContractService => {
|
|
196
|
+
|
|
197
|
+
const buildTx = () => new Transaction();
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
config,
|
|
201
|
+
|
|
202
|
+
registerMerchant: (params) =>
|
|
203
|
+
Effect.tryPromise({
|
|
204
|
+
try: async () => {
|
|
205
|
+
const tx = buildTx();
|
|
206
|
+
tx.moveCall({
|
|
207
|
+
target: `${config.packageId}::one::register_merchant`,
|
|
208
|
+
arguments: [
|
|
209
|
+
tx.object(config.registryId),
|
|
210
|
+
tx.pure.string(params.name),
|
|
211
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
212
|
+
tx.object("0x6"), // Clock object
|
|
213
|
+
],
|
|
214
|
+
});
|
|
215
|
+
return signer.signAndExecuteTransaction(tx);
|
|
216
|
+
},
|
|
217
|
+
catch: (error) =>
|
|
218
|
+
new ONEContractError(
|
|
219
|
+
`Failed to register merchant: ${error}`,
|
|
220
|
+
"REGISTER_MERCHANT_FAILED"
|
|
221
|
+
),
|
|
222
|
+
}),
|
|
223
|
+
|
|
224
|
+
getMerchant: (merchantId) =>
|
|
225
|
+
Effect.tryPromise({
|
|
226
|
+
try: async () => {
|
|
227
|
+
const obj = await suiClient.getObject({
|
|
228
|
+
id: merchantId,
|
|
229
|
+
options: { showContent: true },
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
if (!obj.data?.content || obj.data.content.dataType !== "moveObject") {
|
|
233
|
+
throw new Error("Invalid merchant object");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const fields = obj.data.content.fields as Record<string, unknown>;
|
|
237
|
+
return {
|
|
238
|
+
id: merchantId,
|
|
239
|
+
name: fields.name as string,
|
|
240
|
+
wallet: fields.wallet as string,
|
|
241
|
+
totalSales: BigInt(fields.total_sales as string),
|
|
242
|
+
entityCount: BigInt(fields.entity_count as string),
|
|
243
|
+
isActive: fields.is_active as boolean,
|
|
244
|
+
metadata: JSON.parse(fields.metadata as string),
|
|
245
|
+
createdAt: BigInt(fields.created_at as string),
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
catch: (error) =>
|
|
249
|
+
new ONEContractError(
|
|
250
|
+
`Failed to get merchant: ${error}`,
|
|
251
|
+
"GET_MERCHANT_FAILED"
|
|
252
|
+
),
|
|
253
|
+
}),
|
|
254
|
+
|
|
255
|
+
createEntity: (params) =>
|
|
256
|
+
Effect.tryPromise({
|
|
257
|
+
try: async () => {
|
|
258
|
+
const tx = buildTx();
|
|
259
|
+
tx.moveCall({
|
|
260
|
+
target: `${config.packageId}::one::create_entity`,
|
|
261
|
+
arguments: [
|
|
262
|
+
tx.object(params.merchantId),
|
|
263
|
+
tx.object(params.merchantId + "_cap"), // MerchantCap
|
|
264
|
+
tx.pure.u8(params.entityType),
|
|
265
|
+
tx.pure.string(params.name),
|
|
266
|
+
tx.pure.string(params.description),
|
|
267
|
+
tx.pure.u64(params.price),
|
|
268
|
+
tx.pure.u64(params.maxSupply),
|
|
269
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
270
|
+
tx.object("0x6"), // Clock
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
return signer.signAndExecuteTransaction(tx);
|
|
274
|
+
},
|
|
275
|
+
catch: (error) =>
|
|
276
|
+
new ONEContractError(
|
|
277
|
+
`Failed to create entity: ${error}`,
|
|
278
|
+
"CREATE_ENTITY_FAILED"
|
|
279
|
+
),
|
|
280
|
+
}),
|
|
281
|
+
|
|
282
|
+
getEntity: (entityId) =>
|
|
283
|
+
Effect.tryPromise({
|
|
284
|
+
try: async () => {
|
|
285
|
+
const obj = await suiClient.getObject({
|
|
286
|
+
id: entityId,
|
|
287
|
+
options: { showContent: true },
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
if (!obj.data?.content || obj.data.content.dataType !== "moveObject") {
|
|
291
|
+
throw new Error("Invalid entity object");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const fields = obj.data.content.fields as Record<string, unknown>;
|
|
295
|
+
return {
|
|
296
|
+
id: entityId,
|
|
297
|
+
entityType: fields.entity_type as EntityTypeValue,
|
|
298
|
+
name: fields.name as string,
|
|
299
|
+
description: fields.description as string,
|
|
300
|
+
price: BigInt(fields.price as string),
|
|
301
|
+
merchantId: fields.merchant_id as string,
|
|
302
|
+
isActive: fields.is_active as boolean,
|
|
303
|
+
maxSupply: BigInt(fields.max_supply as string),
|
|
304
|
+
currentSupply: BigInt(fields.current_supply as string),
|
|
305
|
+
metadata: JSON.parse(fields.metadata as string),
|
|
306
|
+
createdAt: BigInt(fields.created_at as string),
|
|
307
|
+
updatedAt: BigInt(fields.updated_at as string),
|
|
308
|
+
};
|
|
309
|
+
},
|
|
310
|
+
catch: (error) =>
|
|
311
|
+
new ONEContractError(
|
|
312
|
+
`Failed to get entity: ${error}`,
|
|
313
|
+
"GET_ENTITY_FAILED"
|
|
314
|
+
),
|
|
315
|
+
}),
|
|
316
|
+
|
|
317
|
+
purchaseEntity: (params) =>
|
|
318
|
+
Effect.tryPromise({
|
|
319
|
+
try: async () => {
|
|
320
|
+
const tx = buildTx();
|
|
321
|
+
tx.moveCall({
|
|
322
|
+
target: `${config.packageId}::one::purchase_entity`,
|
|
323
|
+
arguments: [
|
|
324
|
+
tx.object(config.registryId),
|
|
325
|
+
tx.object(params.merchantId),
|
|
326
|
+
tx.object(params.entityId),
|
|
327
|
+
tx.object(params.paymentCoinId),
|
|
328
|
+
tx.pure.u64(params.expiresInMs),
|
|
329
|
+
tx.object("0x6"), // Clock
|
|
330
|
+
],
|
|
331
|
+
});
|
|
332
|
+
return signer.signAndExecuteTransaction(tx);
|
|
333
|
+
},
|
|
334
|
+
catch: (error) =>
|
|
335
|
+
new ONEContractError(
|
|
336
|
+
`Failed to purchase entity: ${error}`,
|
|
337
|
+
"PURCHASE_ENTITY_FAILED"
|
|
338
|
+
),
|
|
339
|
+
}),
|
|
340
|
+
|
|
341
|
+
getOwnerships: (owner) =>
|
|
342
|
+
Effect.tryPromise({
|
|
343
|
+
try: async () => {
|
|
344
|
+
const objects = await suiClient.getOwnedObjects({
|
|
345
|
+
owner,
|
|
346
|
+
filter: {
|
|
347
|
+
StructType: `${config.packageId}::one::Ownership`,
|
|
348
|
+
},
|
|
349
|
+
options: { showContent: true },
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
return objects.data.map((obj) => {
|
|
353
|
+
if (!obj.data?.content || obj.data.content.dataType !== "moveObject") {
|
|
354
|
+
throw new Error("Invalid ownership object");
|
|
355
|
+
}
|
|
356
|
+
const fields = obj.data.content.fields as Record<string, unknown>;
|
|
357
|
+
return {
|
|
358
|
+
id: obj.data.objectId,
|
|
359
|
+
entityId: fields.entity_id as string,
|
|
360
|
+
entityType: fields.entity_type as EntityTypeValue,
|
|
361
|
+
entityName: fields.entity_name as string,
|
|
362
|
+
owner: fields.owner as string,
|
|
363
|
+
acquiredAt: BigInt(fields.acquired_at as string),
|
|
364
|
+
expiresAt: BigInt(fields.expires_at as string),
|
|
365
|
+
pricePaid: BigInt(fields.price_paid as string),
|
|
366
|
+
metadata: JSON.parse(fields.metadata as string),
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
},
|
|
370
|
+
catch: (error) =>
|
|
371
|
+
new ONEContractError(
|
|
372
|
+
`Failed to get ownerships: ${error}`,
|
|
373
|
+
"GET_OWNERSHIPS_FAILED"
|
|
374
|
+
),
|
|
375
|
+
}),
|
|
376
|
+
|
|
377
|
+
isOwnershipValid: (ownershipId) =>
|
|
378
|
+
Effect.tryPromise({
|
|
379
|
+
try: async () => {
|
|
380
|
+
const obj = await suiClient.getObject({
|
|
381
|
+
id: ownershipId,
|
|
382
|
+
options: { showContent: true },
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (!obj.data?.content || obj.data.content.dataType !== "moveObject") {
|
|
386
|
+
throw new Error("Invalid ownership object");
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const fields = obj.data.content.fields as Record<string, unknown>;
|
|
390
|
+
const expiresAt = BigInt(fields.expires_at as string);
|
|
391
|
+
|
|
392
|
+
if (expiresAt === 0n) return true; // Permanent ownership
|
|
393
|
+
return Date.now() < Number(expiresAt);
|
|
394
|
+
},
|
|
395
|
+
catch: (error) =>
|
|
396
|
+
new ONEContractError(
|
|
397
|
+
`Failed to check ownership: ${error}`,
|
|
398
|
+
"CHECK_OWNERSHIP_FAILED"
|
|
399
|
+
),
|
|
400
|
+
}),
|
|
401
|
+
|
|
402
|
+
listForSale: (params) =>
|
|
403
|
+
Effect.tryPromise({
|
|
404
|
+
try: async () => {
|
|
405
|
+
const tx = buildTx();
|
|
406
|
+
tx.moveCall({
|
|
407
|
+
target: `${config.packageId}::market::list_for_sale`,
|
|
408
|
+
arguments: [
|
|
409
|
+
tx.object(params.ownershipId),
|
|
410
|
+
tx.pure.u64(params.price),
|
|
411
|
+
tx.object("0x6"), // Clock
|
|
412
|
+
],
|
|
413
|
+
});
|
|
414
|
+
return signer.signAndExecuteTransaction(tx);
|
|
415
|
+
},
|
|
416
|
+
catch: (error) =>
|
|
417
|
+
new ONEContractError(
|
|
418
|
+
`Failed to list for sale: ${error}`,
|
|
419
|
+
"LIST_FOR_SALE_FAILED"
|
|
420
|
+
),
|
|
421
|
+
}),
|
|
422
|
+
|
|
423
|
+
// Convenience methods
|
|
424
|
+
createProduct: (params) =>
|
|
425
|
+
Effect.tryPromise({
|
|
426
|
+
try: async () => {
|
|
427
|
+
const tx = buildTx();
|
|
428
|
+
tx.moveCall({
|
|
429
|
+
target: `${config.packageId}::one::create_product`,
|
|
430
|
+
arguments: [
|
|
431
|
+
tx.object(params.merchantId),
|
|
432
|
+
tx.object(params.merchantId + "_cap"),
|
|
433
|
+
tx.pure.string(params.name),
|
|
434
|
+
tx.pure.string(params.description),
|
|
435
|
+
tx.pure.u64(params.price),
|
|
436
|
+
tx.pure.u64(params.maxSupply),
|
|
437
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
438
|
+
tx.object("0x6"),
|
|
439
|
+
],
|
|
440
|
+
});
|
|
441
|
+
return signer.signAndExecuteTransaction(tx);
|
|
442
|
+
},
|
|
443
|
+
catch: (error) =>
|
|
444
|
+
new ONEContractError(
|
|
445
|
+
`Failed to create product: ${error}`,
|
|
446
|
+
"CREATE_PRODUCT_FAILED"
|
|
447
|
+
),
|
|
448
|
+
}),
|
|
449
|
+
|
|
450
|
+
createSubscription: (params) =>
|
|
451
|
+
Effect.tryPromise({
|
|
452
|
+
try: async () => {
|
|
453
|
+
const tx = buildTx();
|
|
454
|
+
tx.moveCall({
|
|
455
|
+
target: `${config.packageId}::one::create_subscription`,
|
|
456
|
+
arguments: [
|
|
457
|
+
tx.object(params.merchantId),
|
|
458
|
+
tx.object(params.merchantId + "_cap"),
|
|
459
|
+
tx.pure.string(params.name),
|
|
460
|
+
tx.pure.string(params.description),
|
|
461
|
+
tx.pure.u64(params.price),
|
|
462
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
463
|
+
tx.object("0x6"),
|
|
464
|
+
],
|
|
465
|
+
});
|
|
466
|
+
return signer.signAndExecuteTransaction(tx);
|
|
467
|
+
},
|
|
468
|
+
catch: (error) =>
|
|
469
|
+
new ONEContractError(
|
|
470
|
+
`Failed to create subscription: ${error}`,
|
|
471
|
+
"CREATE_SUBSCRIPTION_FAILED"
|
|
472
|
+
),
|
|
473
|
+
}),
|
|
474
|
+
|
|
475
|
+
createLesson: (params) =>
|
|
476
|
+
Effect.tryPromise({
|
|
477
|
+
try: async () => {
|
|
478
|
+
const tx = buildTx();
|
|
479
|
+
tx.moveCall({
|
|
480
|
+
target: `${config.packageId}::one::create_lesson`,
|
|
481
|
+
arguments: [
|
|
482
|
+
tx.object(params.merchantId),
|
|
483
|
+
tx.object(params.merchantId + "_cap"),
|
|
484
|
+
tx.pure.string(params.name),
|
|
485
|
+
tx.pure.string(params.description),
|
|
486
|
+
tx.pure.u64(params.price),
|
|
487
|
+
tx.pure.u64(params.maxSupply),
|
|
488
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
489
|
+
tx.object("0x6"),
|
|
490
|
+
],
|
|
491
|
+
});
|
|
492
|
+
return signer.signAndExecuteTransaction(tx);
|
|
493
|
+
},
|
|
494
|
+
catch: (error) =>
|
|
495
|
+
new ONEContractError(
|
|
496
|
+
`Failed to create lesson: ${error}`,
|
|
497
|
+
"CREATE_LESSON_FAILED"
|
|
498
|
+
),
|
|
499
|
+
}),
|
|
500
|
+
|
|
501
|
+
createEventTicket: (params) =>
|
|
502
|
+
Effect.tryPromise({
|
|
503
|
+
try: async () => {
|
|
504
|
+
const tx = buildTx();
|
|
505
|
+
tx.moveCall({
|
|
506
|
+
target: `${config.packageId}::one::create_event_ticket`,
|
|
507
|
+
arguments: [
|
|
508
|
+
tx.object(params.merchantId),
|
|
509
|
+
tx.object(params.merchantId + "_cap"),
|
|
510
|
+
tx.pure.string(params.name),
|
|
511
|
+
tx.pure.string(params.description),
|
|
512
|
+
tx.pure.u64(params.price),
|
|
513
|
+
tx.pure.u64(params.maxSupply),
|
|
514
|
+
tx.pure.string(JSON.stringify(params.metadata)),
|
|
515
|
+
tx.object("0x6"),
|
|
516
|
+
],
|
|
517
|
+
});
|
|
518
|
+
return signer.signAndExecuteTransaction(tx);
|
|
519
|
+
},
|
|
520
|
+
catch: (error) =>
|
|
521
|
+
new ONEContractError(
|
|
522
|
+
`Failed to create event ticket: ${error}`,
|
|
523
|
+
"CREATE_EVENT_TICKET_FAILED"
|
|
524
|
+
),
|
|
525
|
+
}),
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// ============================================================
|
|
530
|
+
// LAYER - Effect.ts Pattern
|
|
531
|
+
// ============================================================
|
|
532
|
+
|
|
533
|
+
export const ONEContractServiceLive = (
|
|
534
|
+
suiClient: SuiClient,
|
|
535
|
+
config: ONEContractConfig,
|
|
536
|
+
signer: { signAndExecuteTransaction: (tx: Transaction) => Promise<SuiTransactionBlockResponse> }
|
|
537
|
+
) =>
|
|
538
|
+
Layer.succeed(
|
|
539
|
+
ONEContractService,
|
|
540
|
+
makeONEContractService(suiClient, config, signer)
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
// ============================================================
|
|
544
|
+
// HELPER FUNCTIONS
|
|
545
|
+
// ============================================================
|
|
546
|
+
|
|
547
|
+
/** Convert SUI to MIST */
|
|
548
|
+
export const suiToMist = (sui: number): bigint => BigInt(sui * 1_000_000_000);
|
|
549
|
+
|
|
550
|
+
/** Convert MIST to SUI */
|
|
551
|
+
export const mistToSui = (mist: bigint): number => Number(mist) / 1_000_000_000;
|
|
552
|
+
|
|
553
|
+
/** Get entity type name */
|
|
554
|
+
export const getEntityTypeName = (type: EntityTypeValue): string => {
|
|
555
|
+
const names: Record<EntityTypeValue, string> = {
|
|
556
|
+
1: "Product",
|
|
557
|
+
2: "Subscription",
|
|
558
|
+
3: "Lesson",
|
|
559
|
+
4: "Membership",
|
|
560
|
+
5: "Credential",
|
|
561
|
+
6: "Token",
|
|
562
|
+
7: "NFT",
|
|
563
|
+
8: "Access Pass",
|
|
564
|
+
9: "Event Ticket",
|
|
565
|
+
10: "Digital Good",
|
|
566
|
+
11: "Service",
|
|
567
|
+
12: "License",
|
|
568
|
+
};
|
|
569
|
+
return names[type] || "Unknown";
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/** Calculate subscription duration in milliseconds */
|
|
573
|
+
export const subscriptionDuration = {
|
|
574
|
+
day: 24 * 60 * 60 * 1000,
|
|
575
|
+
week: 7 * 24 * 60 * 60 * 1000,
|
|
576
|
+
month: 30 * 24 * 60 * 60 * 1000,
|
|
577
|
+
year: 365 * 24 * 60 * 60 * 1000,
|
|
578
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ONE Empire: Feature Specification
|
|
2
|
+
|
|
3
|
+
**Version**: 1.0.0 **Tier**: Agency License (The Launchpad) **Architecture**: Full-Stack / Whitelabel / Omnichannel
|
|
4
|
+
|
|
5
|
+
## 🏛️ Core Philosophy: Business-in-a-Box
|
|
6
|
+
|
|
7
|
+
ONE Empire is not just the payment technology; it is the **entire sales infrastructure**. It includes the high-conversion landing page, the marketing bots, and the reseller rights to deploy this for clients.
|
|
8
|
+
|
|
9
|
+
## 💻 1. The "Golden Template" Website
|
|
10
|
+
|
|
11
|
+
A deployment-ready Astro/React website optimized for token presales.
|
|
12
|
+
|
|
13
|
+
- **Design**: Dark mode, high-contrast, "Apple meets Matrix" aesthetic.
|
|
14
|
+
|
|
15
|
+
- **Components**:
|
|
16
|
+
|
|
17
|
+
- **Hero Section**: Dynamic "Funds Raised" ticker.
|
|
18
|
+
|
|
19
|
+
- **Pricing/Tokenomics**: Interactive charts.
|
|
20
|
+
|
|
21
|
+
- **The Payment Terminal**: Integrated AI Chatbot + UniversalPay button.
|
|
22
|
+
|
|
23
|
+
- **Admin Dashboard**: Hidden route for the merchant to view sales.
|
|
24
|
+
|
|
25
|
+
- **Tech Stack**: Astro 4.0, Tailwind CSS, Framer Motion.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 🤖 2. Omnichannel Bot Suite
|
|
29
|
+
|
|
30
|
+
Sell your token where your community lives.
|
|
31
|
+
|
|
32
|
+
### Telegram Sales Bot
|
|
33
|
+
|
|
34
|
+
- **Commands**: `/buy`, `/price`, `/wallet`.
|
|
35
|
+
|
|
36
|
+
- **Identity**: Automatically links Telegram ID to a deposit address.
|
|
37
|
+
|
|
38
|
+
- **Notifications**: DMs the user when their purchase is confirmed.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Discord Sales Bot
|
|
42
|
+
|
|
43
|
+
- **Slash Commands**: Integrated into your Discord server.
|
|
44
|
+
|
|
45
|
+
- **Role Gating**: Automatically assigns "Investor" roles upon purchase.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## 🏢 3. Agency Features
|
|
49
|
+
|
|
50
|
+
- **Whitelabel**: "Powered by ONE" branding is removed.
|
|
51
|
+
|
|
52
|
+
- **Multi-Client Capable**: Deploy distinct Workers for different clients using the same code base.
|
|
53
|
+
|
|
54
|
+
- **Client Handover**: Simple config files to hand off the project to a client.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## 🚀 Includes ALL Pro Features
|
|
58
|
+
|
|
59
|
+
- **Identity Foundry**
|
|
60
|
+
|
|
61
|
+
- **Concierge Relayer**
|
|
62
|
+
|
|
63
|
+
- **Subscription Engine**
|
|
64
|
+
|
|
65
|
+
- **Smart Sweeper**
|
|
66
|
+
|
|
67
|
+
- **AI Sales Agent**
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 📦 Deliverables
|
|
71
|
+
|
|
72
|
+
1. **`backend/`**: The ONE Pro Worker.
|
|
73
|
+
|
|
74
|
+
2. **`web/`**: The Astro Website Source.
|
|
75
|
+
|
|
76
|
+
3. **`bots/`**: Telegram & Discord Bot Source.
|
|
77
|
+
|
|
78
|
+
4. **`contracts/`**: EVM & Move Presale Contracts.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Product: ONE Core (Tier 1)
|
|
2
|
+
|
|
3
|
+
**Subtitle:** The Universal Payment Protocol. **Price:** $299 (One-Time)
|
|
4
|
+
|
|
5
|
+
## The Problem: Renting Your Infrastructure
|
|
6
|
+
|
|
7
|
+
Every time you use Stripe, Coinbase Commerce, or BitPay, you are renting your business. You pay 1% fees forever. You risk deplatforming every day. You are a tenant in your own house.
|
|
8
|
+
|
|
9
|
+
## The Solution: ONE Core
|
|
10
|
+
|
|
11
|
+
ONE Core is a self-hosted, stateless payment node that runs on **your** infrastructure (Cloudflare Workers). It allows you to accept crypto on _any_ chain (ETH, SOL, BTC) and settle verification on _your_ chain (EVM, Sui).
|
|
12
|
+
|
|
13
|
+
### 🛠️ What You Get (The Tech Stack)
|
|
14
|
+
|
|
15
|
+
#### 1. The Universal Worker (Backend)
|
|
16
|
+
|
|
17
|
+
A Node.js Cloudflare Worker that acts as a cryptographic oracle.
|
|
18
|
+
|
|
19
|
+
- **Stateless:** No database required.
|
|
20
|
+
|
|
21
|
+
- **Universal:** Verifies tx hashes from Ethereum, Base, Solana, and Bitcoin.
|
|
22
|
+
|
|
23
|
+
- **Secure:** It holds a **Signing Key**, not your Treasury Key. Even if hacked, your funds are safe in cold storage.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
#### 2. The Smart Contracts (Verifiers)
|
|
27
|
+
|
|
28
|
+
Pre-audited contracts ready for deployment.
|
|
29
|
+
|
|
30
|
+
- **EVM (Solidity):** `UniversalVerifier.sol` (EIP-712 Compliant).
|
|
31
|
+
|
|
32
|
+
- **Sui (Move):** `verifier.move` (Ed25519 Compliant).
|
|
33
|
+
|
|
34
|
+
- **Anti-Replay:** Deterministic nonce generation prevents double-spending without a centralized database.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
#### 3. The Frontend Kit
|
|
38
|
+
|
|
39
|
+
Drop-in components for React and Astro.
|
|
40
|
+
|
|
41
|
+
- **`<UniversalPay />`**: A single component that handles the entire flow: Quote -> Payment -> Verification -> Claim.
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### 💰 The Economics
|
|
45
|
+
|
|
46
|
+
- **Cost:** $0/month (Runs on Cloudflare Free Tier).
|
|
47
|
+
|
|
48
|
+
- **Fees:** 0% Transaction Fees.
|
|
49
|
+
|
|
50
|
+
- **License:** Lifetime Commercial Use (Unlimited Projects).
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Who is this for?
|
|
54
|
+
|
|
55
|
+
- **Developers** building custom dApps.
|
|
56
|
+
|
|
57
|
+
- **Indie Hackers** who want a "Stripe for Crypto" without the KYC.
|
|
58
|
+
|
|
59
|
+
- **DAOs** who need a trustless payment terminal.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
[ **Buy Source Code - $299** ]
|