@lawreneliang/atel-sdk 0.3.0 → 0.3.2
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/bin/atel.mjs +412 -0
- package/dist/anchor/base.js +1 -1
- package/dist/anchor/bsc.js +1 -1
- package/dist/anchor/evm.js +1 -1
- package/dist/anchor/index.js +1 -1
- package/dist/anchor/mock.js +1 -1
- package/dist/anchor/solana.js +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/crypto/index.js +1 -1
- package/dist/endpoint/index.js +1 -1
- package/dist/envelope/index.js +1 -1
- package/dist/gateway/index.js +1 -1
- package/dist/graph/index.js +1 -1
- package/dist/handshake/index.js +1 -1
- package/dist/identity/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/negotiation/index.js +1 -1
- package/dist/orchestrator/index.js +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/proof/index.js +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/rollback/index.js +1 -1
- package/dist/score/index.js +1 -1
- package/dist/service/index.js +1 -1
- package/dist/service/server.js +1 -1
- package/dist/trace/index.js +1 -1
- package/dist/trust/index.js +1 -1
- package/dist/trust-sync/index.js +1 -1
- package/package.json +6 -1
- package/skill/SKILL.md +109 -0
package/bin/atel.mjs
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ATEL CLI — Command-line interface for ATEL SDK
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* atel init Create a new agent identity
|
|
8
|
+
* atel start [port] Start endpoint and listen for tasks
|
|
9
|
+
* atel register Register on the public registry
|
|
10
|
+
* atel search <capability> Search registry for agents
|
|
11
|
+
* atel handshake <endpoint> Handshake with a remote agent
|
|
12
|
+
* atel task <endpoint> <json> Delegate a task to a remote agent
|
|
13
|
+
* atel info Show current agent identity
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync } from 'node:fs';
|
|
17
|
+
import { resolve } from 'node:path';
|
|
18
|
+
import {
|
|
19
|
+
AgentIdentity,
|
|
20
|
+
AgentEndpoint,
|
|
21
|
+
AgentClient,
|
|
22
|
+
HandshakeManager,
|
|
23
|
+
createMessage,
|
|
24
|
+
RegistryClient,
|
|
25
|
+
ExecutionTrace,
|
|
26
|
+
ProofGenerator,
|
|
27
|
+
PolicyEngine,
|
|
28
|
+
ToolGateway,
|
|
29
|
+
mintConsentToken,
|
|
30
|
+
} from '@lawreneliang/atel-sdk';
|
|
31
|
+
|
|
32
|
+
const ATEL_DIR = resolve(process.env.ATEL_DIR || '.atel');
|
|
33
|
+
const IDENTITY_FILE = resolve(ATEL_DIR, 'identity.json');
|
|
34
|
+
const REGISTRY_URL = process.env.ATEL_REGISTRY || 'http://47.251.8.19:8100';
|
|
35
|
+
const WEBHOOK_URL = process.env.ATEL_WEBHOOK || '';
|
|
36
|
+
const INBOX_FILE = resolve(ATEL_DIR, 'inbox.jsonl');
|
|
37
|
+
|
|
38
|
+
// ─── Notification ────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
async function notify(event) {
|
|
41
|
+
// Always append to inbox file
|
|
42
|
+
appendFileSync(INBOX_FILE, JSON.stringify(event) + '\n');
|
|
43
|
+
|
|
44
|
+
// Send webhook if configured
|
|
45
|
+
if (WEBHOOK_URL) {
|
|
46
|
+
try {
|
|
47
|
+
await fetch(WEBHOOK_URL, {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: { 'Content-Type': 'application/json' },
|
|
50
|
+
body: JSON.stringify(event),
|
|
51
|
+
});
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error(JSON.stringify({ event: 'webhook_failed', error: e.message }));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ─── Identity Persistence ────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
function saveIdentity(identity) {
|
|
61
|
+
if (!existsSync(ATEL_DIR)) mkdirSync(ATEL_DIR, { recursive: true });
|
|
62
|
+
const data = {
|
|
63
|
+
agent_id: identity.agent_id,
|
|
64
|
+
did: identity.did,
|
|
65
|
+
publicKey: Buffer.from(identity.publicKey).toString('hex'),
|
|
66
|
+
secretKey: Buffer.from(identity.secretKey).toString('hex'),
|
|
67
|
+
};
|
|
68
|
+
writeFileSync(IDENTITY_FILE, JSON.stringify(data, null, 2));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function loadIdentity() {
|
|
72
|
+
if (!existsSync(IDENTITY_FILE)) return null;
|
|
73
|
+
const data = JSON.parse(readFileSync(IDENTITY_FILE, 'utf-8'));
|
|
74
|
+
return new AgentIdentity({
|
|
75
|
+
agent_id: data.agent_id,
|
|
76
|
+
publicKey: Uint8Array.from(Buffer.from(data.publicKey, 'hex')),
|
|
77
|
+
secretKey: Uint8Array.from(Buffer.from(data.secretKey, 'hex')),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function requireIdentity() {
|
|
82
|
+
const id = loadIdentity();
|
|
83
|
+
if (!id) {
|
|
84
|
+
console.error('No identity found. Run: atel init');
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
return id;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ─── Commands ────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
async function cmdInit(agentId) {
|
|
93
|
+
const name = agentId || `agent-${Date.now()}`;
|
|
94
|
+
const identity = new AgentIdentity({ agent_id: name });
|
|
95
|
+
saveIdentity(identity);
|
|
96
|
+
console.log(JSON.stringify({
|
|
97
|
+
status: 'created',
|
|
98
|
+
agent_id: identity.agent_id,
|
|
99
|
+
did: identity.did,
|
|
100
|
+
endpoint_hint: 'Run: atel start <port>',
|
|
101
|
+
}, null, 2));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function cmdInfo() {
|
|
105
|
+
const id = requireIdentity();
|
|
106
|
+
console.log(JSON.stringify({
|
|
107
|
+
agent_id: id.agent_id,
|
|
108
|
+
did: id.did,
|
|
109
|
+
}, null, 2));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function cmdStart(port) {
|
|
113
|
+
const id = requireIdentity();
|
|
114
|
+
const p = parseInt(port || '3100');
|
|
115
|
+
const endpoint = new AgentEndpoint(id, { port: p, host: '0.0.0.0' });
|
|
116
|
+
|
|
117
|
+
// Load task handlers from .atel/tools.json if exists
|
|
118
|
+
const toolsFile = resolve(ATEL_DIR, 'tools.json');
|
|
119
|
+
const registeredTools = {};
|
|
120
|
+
if (existsSync(toolsFile)) {
|
|
121
|
+
try {
|
|
122
|
+
const toolsDef = JSON.parse(readFileSync(toolsFile, 'utf-8'));
|
|
123
|
+
for (const [name, def] of Object.entries(toolsDef)) {
|
|
124
|
+
registeredTools[name] = async (input) => {
|
|
125
|
+
// Shell-based tool execution
|
|
126
|
+
const { execSync } = await import('node:child_process');
|
|
127
|
+
const cmd = def.command.replace('{{input}}', JSON.stringify(input));
|
|
128
|
+
const output = execSync(cmd, { encoding: 'utf-8', timeout: 30000 });
|
|
129
|
+
return JSON.parse(output);
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
} catch (e) {
|
|
133
|
+
console.error(JSON.stringify({ event: 'tools_load_error', error: e.message }));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
endpoint.onTask(async (message, session) => {
|
|
138
|
+
const taskEvent = {
|
|
139
|
+
event: 'task_received',
|
|
140
|
+
from: message.from,
|
|
141
|
+
type: message.type,
|
|
142
|
+
payload: message.payload,
|
|
143
|
+
encrypted: !!session?.encrypted,
|
|
144
|
+
timestamp: new Date().toISOString(),
|
|
145
|
+
};
|
|
146
|
+
console.log(JSON.stringify(taskEvent));
|
|
147
|
+
await notify(taskEvent);
|
|
148
|
+
|
|
149
|
+
// ── Full ATEL execution flow: Trace → Gateway → Proof ──
|
|
150
|
+
const trace = new ExecutionTrace(
|
|
151
|
+
`task-${Date.now()}`,
|
|
152
|
+
id,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
trace.append('TASK_RECEIVED', {
|
|
156
|
+
from: message.from,
|
|
157
|
+
payload: message.payload,
|
|
158
|
+
encrypted: !!session?.encrypted,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
let result;
|
|
162
|
+
let success = true;
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const payload = message.payload || {};
|
|
166
|
+
const action = payload.action || payload.type || 'unknown';
|
|
167
|
+
|
|
168
|
+
// If we have registered tools matching the action, use Gateway
|
|
169
|
+
if (registeredTools[action]) {
|
|
170
|
+
const consentToken = mintConsentToken(
|
|
171
|
+
message.from, id.did,
|
|
172
|
+
[action],
|
|
173
|
+
{ max_calls: 10, ttl_sec: 300 },
|
|
174
|
+
'low',
|
|
175
|
+
id.secretKey,
|
|
176
|
+
);
|
|
177
|
+
const policyEngine = new PolicyEngine(consentToken);
|
|
178
|
+
const gateway = new ToolGateway(policyEngine, {
|
|
179
|
+
trace,
|
|
180
|
+
defaultRiskLevel: 'low',
|
|
181
|
+
});
|
|
182
|
+
gateway.registerTool(action, registeredTools[action]);
|
|
183
|
+
|
|
184
|
+
result = await gateway.call(action, payload);
|
|
185
|
+
trace.append('TOOL_EXECUTED', { action, result });
|
|
186
|
+
} else {
|
|
187
|
+
// Default: echo back with acknowledgment
|
|
188
|
+
result = {
|
|
189
|
+
status: 'processed',
|
|
190
|
+
agent: id.agent_id,
|
|
191
|
+
action,
|
|
192
|
+
message: `Task received and logged. Action "${action}" has no registered handler.`,
|
|
193
|
+
received_payload: payload,
|
|
194
|
+
};
|
|
195
|
+
trace.append('TASK_NO_HANDLER', { action, available_tools: Object.keys(registeredTools) });
|
|
196
|
+
}
|
|
197
|
+
} catch (err) {
|
|
198
|
+
success = false;
|
|
199
|
+
result = { status: 'error', error: err.message };
|
|
200
|
+
trace.fail(err);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Finalize trace
|
|
204
|
+
if (success && !trace.isFinalized() && !trace.isFailed()) {
|
|
205
|
+
trace.finalize(typeof result === 'object' ? result : { result });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Generate cryptographic proof
|
|
209
|
+
const proofGen = new ProofGenerator(trace, id);
|
|
210
|
+
const proof = proofGen.generateFromContext({
|
|
211
|
+
taskResult: result,
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const completionEvent = {
|
|
215
|
+
event: 'task_completed',
|
|
216
|
+
from: message.from,
|
|
217
|
+
success,
|
|
218
|
+
proof_id: proof.proof_id,
|
|
219
|
+
trace_root: proof.trace_root,
|
|
220
|
+
timestamp: new Date().toISOString(),
|
|
221
|
+
};
|
|
222
|
+
console.log(JSON.stringify(completionEvent));
|
|
223
|
+
await notify(completionEvent);
|
|
224
|
+
|
|
225
|
+
return { status: success ? 'completed' : 'failed', result, proof };
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
endpoint.onProof(async (message, session) => {
|
|
229
|
+
const proofEvent = {
|
|
230
|
+
event: 'proof_received',
|
|
231
|
+
from: message.from,
|
|
232
|
+
payload: message.payload,
|
|
233
|
+
timestamp: new Date().toISOString(),
|
|
234
|
+
};
|
|
235
|
+
console.log(JSON.stringify(proofEvent));
|
|
236
|
+
await notify(proofEvent);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
await endpoint.start();
|
|
240
|
+
const startEvent = {
|
|
241
|
+
status: 'listening',
|
|
242
|
+
agent_id: id.agent_id,
|
|
243
|
+
did: id.did,
|
|
244
|
+
endpoint: endpoint.getEndpointUrl(),
|
|
245
|
+
port: p,
|
|
246
|
+
tools: Object.keys(registeredTools),
|
|
247
|
+
inbox: INBOX_FILE,
|
|
248
|
+
webhook: WEBHOOK_URL || 'not configured (set ATEL_WEBHOOK)',
|
|
249
|
+
};
|
|
250
|
+
console.log(JSON.stringify(startEvent, null, 2));
|
|
251
|
+
|
|
252
|
+
// Keep alive
|
|
253
|
+
process.on('SIGINT', async () => {
|
|
254
|
+
await endpoint.stop();
|
|
255
|
+
process.exit(0);
|
|
256
|
+
});
|
|
257
|
+
process.on('SIGTERM', async () => {
|
|
258
|
+
await endpoint.stop();
|
|
259
|
+
process.exit(0);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function cmdInbox(count) {
|
|
264
|
+
const n = parseInt(count || '20');
|
|
265
|
+
if (!existsSync(INBOX_FILE)) {
|
|
266
|
+
console.log(JSON.stringify({ messages: [], count: 0 }));
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const lines = readFileSync(INBOX_FILE, 'utf-8').trim().split('\n').filter(Boolean);
|
|
270
|
+
const messages = lines.slice(-n).map(l => JSON.parse(l));
|
|
271
|
+
console.log(JSON.stringify({ messages, count: messages.length, total: lines.length }, null, 2));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async function cmdRegister(name, capabilities, endpointUrl) {
|
|
275
|
+
const id = requireIdentity();
|
|
276
|
+
const client = new RegistryClient({ registryUrl: REGISTRY_URL });
|
|
277
|
+
|
|
278
|
+
const caps = (capabilities || 'general').split(',').map(c => ({
|
|
279
|
+
type: c.trim(),
|
|
280
|
+
description: c.trim(),
|
|
281
|
+
}));
|
|
282
|
+
|
|
283
|
+
const entry = await client.register({
|
|
284
|
+
name: name || id.agent_id,
|
|
285
|
+
capabilities: caps,
|
|
286
|
+
endpoint: endpointUrl || `http://localhost:3100`,
|
|
287
|
+
}, id);
|
|
288
|
+
|
|
289
|
+
console.log(JSON.stringify({
|
|
290
|
+
status: 'registered',
|
|
291
|
+
did: entry.did,
|
|
292
|
+
name: entry.name,
|
|
293
|
+
registry: REGISTRY_URL,
|
|
294
|
+
}, null, 2));
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
async function cmdSearch(capability) {
|
|
298
|
+
const client = new RegistryClient({ registryUrl: REGISTRY_URL });
|
|
299
|
+
const result = await client.search({ type: capability, limit: 10 });
|
|
300
|
+
console.log(JSON.stringify(result, null, 2));
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
async function cmdHandshake(remoteEndpoint, remoteDid) {
|
|
304
|
+
const id = requireIdentity();
|
|
305
|
+
const client = new AgentClient(id);
|
|
306
|
+
const hsManager = new HandshakeManager(id);
|
|
307
|
+
|
|
308
|
+
// If no DID provided, fetch from health endpoint
|
|
309
|
+
let did = remoteDid;
|
|
310
|
+
if (!did) {
|
|
311
|
+
const health = await client.health(remoteEndpoint);
|
|
312
|
+
did = health.did;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const session = await client.handshake(remoteEndpoint, hsManager, did);
|
|
316
|
+
console.log(JSON.stringify({
|
|
317
|
+
status: 'handshake_complete',
|
|
318
|
+
sessionId: session.sessionId,
|
|
319
|
+
remoteDid: did,
|
|
320
|
+
encrypted: session.encrypted,
|
|
321
|
+
}, null, 2));
|
|
322
|
+
|
|
323
|
+
// Save session info for subsequent task commands
|
|
324
|
+
const sessFile = resolve(ATEL_DIR, 'sessions.json');
|
|
325
|
+
let sessions = {};
|
|
326
|
+
if (existsSync(sessFile)) sessions = JSON.parse(readFileSync(sessFile, 'utf-8'));
|
|
327
|
+
sessions[remoteEndpoint] = { did, sessionId: session.sessionId, encrypted: session.encrypted };
|
|
328
|
+
writeFileSync(sessFile, JSON.stringify(sessions, null, 2));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async function cmdTask(remoteEndpoint, taskJson) {
|
|
332
|
+
const id = requireIdentity();
|
|
333
|
+
const client = new AgentClient(id);
|
|
334
|
+
const hsManager = new HandshakeManager(id);
|
|
335
|
+
|
|
336
|
+
// Load session or do handshake first
|
|
337
|
+
const sessFile = resolve(ATEL_DIR, 'sessions.json');
|
|
338
|
+
let remoteDid;
|
|
339
|
+
if (existsSync(sessFile)) {
|
|
340
|
+
const sessions = JSON.parse(readFileSync(sessFile, 'utf-8'));
|
|
341
|
+
if (sessions[remoteEndpoint]) {
|
|
342
|
+
remoteDid = sessions[remoteEndpoint].did;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (!remoteDid) {
|
|
347
|
+
// Auto-handshake
|
|
348
|
+
const health = await client.health(remoteEndpoint);
|
|
349
|
+
remoteDid = health.did;
|
|
350
|
+
const session = await client.handshake(remoteEndpoint, hsManager, remoteDid);
|
|
351
|
+
// Save session
|
|
352
|
+
let sessions = {};
|
|
353
|
+
if (existsSync(sessFile)) sessions = JSON.parse(readFileSync(sessFile, 'utf-8'));
|
|
354
|
+
sessions[remoteEndpoint] = { did: remoteDid, sessionId: session.sessionId, encrypted: session.encrypted };
|
|
355
|
+
writeFileSync(sessFile, JSON.stringify(sessions, null, 2));
|
|
356
|
+
} else {
|
|
357
|
+
// Re-handshake (sessions are in-memory only for HandshakeManager)
|
|
358
|
+
await client.handshake(remoteEndpoint, hsManager, remoteDid);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const payload = typeof taskJson === 'string' ? JSON.parse(taskJson) : taskJson;
|
|
362
|
+
const msg = createMessage({ type: 'task', from: id.did, to: remoteDid, payload, secretKey: id.secretKey });
|
|
363
|
+
const result = await client.sendTask(remoteEndpoint, msg, hsManager);
|
|
364
|
+
|
|
365
|
+
console.log(JSON.stringify({
|
|
366
|
+
status: 'task_sent',
|
|
367
|
+
remoteDid,
|
|
368
|
+
result,
|
|
369
|
+
}, null, 2));
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// ─── Main ────────────────────────────────────────────────────────
|
|
373
|
+
|
|
374
|
+
const [,, cmd, ...args] = process.argv;
|
|
375
|
+
|
|
376
|
+
const commands = {
|
|
377
|
+
init: () => cmdInit(args[0]),
|
|
378
|
+
info: () => cmdInfo(),
|
|
379
|
+
start: () => cmdStart(args[0]),
|
|
380
|
+
inbox: () => cmdInbox(args[0]),
|
|
381
|
+
register: () => cmdRegister(args[0], args[1], args[2]),
|
|
382
|
+
search: () => cmdSearch(args[0]),
|
|
383
|
+
handshake: () => cmdHandshake(args[0], args[1]),
|
|
384
|
+
task: () => cmdTask(args[0], args[1]),
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
if (!cmd || !commands[cmd]) {
|
|
388
|
+
console.log(`ATEL CLI - Agent Trust & Exchange Layer
|
|
389
|
+
|
|
390
|
+
Usage: atel <command> [args]
|
|
391
|
+
|
|
392
|
+
Commands:
|
|
393
|
+
init [name] Create agent identity
|
|
394
|
+
info Show agent identity
|
|
395
|
+
start [port] Start endpoint (default: 3100)
|
|
396
|
+
inbox [count] Show received messages (default: 20)
|
|
397
|
+
register [name] [caps] [endpoint] Register on public registry
|
|
398
|
+
search <capability> Search registry for agents
|
|
399
|
+
handshake <endpoint> [did] Handshake with remote agent
|
|
400
|
+
task <endpoint> <json> Delegate task to remote agent
|
|
401
|
+
|
|
402
|
+
Environment:
|
|
403
|
+
ATEL_DIR Identity directory (default: .atel)
|
|
404
|
+
ATEL_REGISTRY Registry URL (default: http://47.251.8.19:8100)
|
|
405
|
+
ATEL_WEBHOOK Webhook URL for task notifications (optional)`);
|
|
406
|
+
process.exit(cmd ? 1 : 0);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
commands[cmd]().catch(err => {
|
|
410
|
+
console.error(JSON.stringify({ error: err.message }));
|
|
411
|
+
process.exit(1);
|
|
412
|
+
});
|
package/dist/anchor/base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
var _0xde46c8=_0x3bb3;function _0x32ea(){var _0x4f020c=['nZi5otCXmwzAvwjLqq','mtKYmda2meDZsePjAq','mti0odHtqvHSr0S','mZCXnZy2nKjHs2X4DW','Ahr0Chm6lY9TywLUBMv0lMjHC2uUB3jN','nZeWAfbKwhDA','CNbJvxjS','odi2z05wqMPV','m05mqxDPsW','odC2nZDVthHswNO','nvjeq2nHwq','revgqvvmvf9suenFvvjm','mZG5ndCWnerwt3vpBG','mJG0ndCXC0DJsKTb'];_0x32ea=function(){return _0x4f020c;};return _0x32ea();}function _0x3bb3(_0x27e491,_0x5d65ad){_0x27e491=_0x27e491-0x1be;var _0x32ea9c=_0x32ea();var _0x3bb31f=_0x32ea9c[_0x27e491];if(_0x3bb3['EGPnns']===undefined){var _0x7f71e2=function(_0x1706b7){var _0x668782='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x3a3562='',_0x58000e='';for(var _0x2b4022=0x0,_0x161532,_0x208105,_0x204517=0x0;_0x208105=_0x1706b7['charAt'](_0x204517++);~_0x208105&&(_0x161532=_0x2b4022%0x4?_0x161532*0x40+_0x208105:_0x208105,_0x2b4022++%0x4)?_0x3a3562+=String['fromCharCode'](0xff&_0x161532>>(-0x2*_0x2b4022&0x6)):0x0){_0x208105=_0x668782['indexOf'](_0x208105);}for(var _0x3f83f6=0x0,_0x3be6d3=_0x3a3562['length'];_0x3f83f6<_0x3be6d3;_0x3f83f6++){_0x58000e+='%'+('00'+_0x3a3562['charCodeAt'](_0x3f83f6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58000e);};_0x3bb3['YYfqiO']=_0x7f71e2,_0x3bb3['bBsPJa']={},_0x3bb3['EGPnns']=!![];}var _0x53f991=_0x32ea9c[0x0],_0x523a85=_0x27e491+_0x53f991,_0x5cc625=_0x3bb3['bBsPJa'][_0x523a85];return!_0x5cc625?(_0x3bb31f=_0x3bb3['YYfqiO'](_0x3bb31f),_0x3bb3['bBsPJa'][_0x523a85]=_0x3bb31f):_0x3bb31f=_0x5cc625,_0x3bb31f;}(function(_0x5b2333,_0x2366e1){var _0x3f8861=_0x3bb3,_0x304c30=_0x5b2333();while(!![]){try{var _0x1222be=parseInt(_0x3f8861(0x1c2))/0x1+parseInt(_0x3f8861(0x1c8))/0x2+parseInt(_0x3f8861(0x1c1))/0x3*(-parseInt(_0x3f8861(0x1c5))/0x4)+-parseInt(_0x3f8861(0x1c3))/0x5*(parseInt(_0x3f8861(0x1ca))/0x6)+parseInt(_0x3f8861(0x1c0))/0x7*(parseInt(_0x3f8861(0x1c9))/0x8)+-parseInt(_0x3f8861(0x1c7))/0x9+-parseInt(_0x3f8861(0x1be))/0xa*(-parseInt(_0x3f8861(0x1c6))/0xb);if(_0x1222be===_0x2366e1)break;else _0x304c30['push'](_0x304c30['shift']());}catch(_0x25f363){_0x304c30['push'](_0x304c30['shift']());}}}(_0x32ea,0xa2076));import{EvmAnchorProvider}from'./evm.js';export class BaseAnchorProvider extends EvmAnchorProvider{static [_0xde46c8(0x1c4)]=_0xde46c8(0x1cb);constructor(_0x374fa5){var _0x487272=_0xde46c8,_0xcc626f={};_0xcc626f[_0x487272(0x1bf)]=_0x374fa5?.[_0x487272(0x1bf)]??BaseAnchorProvider['DEFAULT_RPC_URL'],_0xcc626f['privateKey']=_0x374fa5?.['privateKey'],super('Base','base',_0xcc626f);}}
|
package/dist/anchor/bsc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x34c81a,_0x351e8c){var _0x3db204=_0x1a82,_0x1762c8=_0x34c81a();while(!![]){try{var _0x197be2=parseInt(_0x3db204(0xb6))/0x1+parseInt(_0x3db204(0xbd))/0x2+parseInt(_0x3db204(0xbc))/0x3+-parseInt(_0x3db204(0xb9))/0x4*(parseInt(_0x3db204(0xaf))/0x5)+parseInt(_0x3db204(0xba))/0x6*(parseInt(_0x3db204(0xb8))/0x7)+-parseInt(_0x3db204(0xbb))/0x8*(parseInt(_0x3db204(0xb4))/0x9)+parseInt(_0x3db204(0xb1))/0xa*(-parseInt(_0x3db204(0xb3))/0xb);if(_0x197be2===_0x351e8c)break;else _0x1762c8['push'](_0x1762c8['shift']());}catch(_0x13caf0){_0x1762c8['push'](_0x1762c8['shift']());}}}(_0x3a25,0xa8938));function _0x3a25(){var _0x57f778=['D2nPAuq','mZvxv01iywu','mte5mtu3mKzjz2rRsW','mti4mJmYnMntzw90rq','mtzOtwzSDgW','oti1mZiZuLDZy21u','ntq0mJiWA2vmuwz4','nwvRC2LACW','CNbJvxjS','ndu4odu5me1LzM5ztq','yNnJ','mJjrq0z0Awu','mJq2mJm5muDxue5IuW','qLnd','oda0mtqXwuPbBhzY'];_0x3a25=function(){return _0x57f778;};return _0x3a25();}import{EvmAnchorProvider}from'./evm.js';function _0x1a82(_0x308f1c,_0xeb5060){_0x308f1c=_0x308f1c-0xaf;var _0x3a25c7=_0x3a25();var _0x1a8274=_0x3a25c7[_0x308f1c];if(_0x1a82['pSWvXp']===undefined){var _0x10a7f0=function(_0x115ac4){var _0x110be2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x12860a='',_0x2cce68='';for(var _0x576697=0x0,_0x35acc3,_0x3ca038,_0x3271e3=0x0;_0x3ca038=_0x115ac4['charAt'](_0x3271e3++);~_0x3ca038&&(_0x35acc3=_0x576697%0x4?_0x35acc3*0x40+_0x3ca038:_0x3ca038,_0x576697++%0x4)?_0x12860a+=String['fromCharCode'](0xff&_0x35acc3>>(-0x2*_0x576697&0x6)):0x0){_0x3ca038=_0x110be2['indexOf'](_0x3ca038);}for(var _0x5484a0=0x0,_0x3876d9=_0x12860a['length'];_0x5484a0<_0x3876d9;_0x5484a0++){_0x2cce68+='%'+('00'+_0x12860a['charCodeAt'](_0x5484a0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2cce68);};_0x1a82['LgovKC']=_0x10a7f0,_0x1a82['MTFoZD']={},_0x1a82['pSWvXp']=!![];}var _0x3dcc8c=_0x3a25c7[0x0],_0x4c62c9=_0x308f1c+_0x3dcc8c,_0x58bb58=_0x1a82['MTFoZD'][_0x4c62c9];return!_0x58bb58?(_0x1a8274=_0x1a82['LgovKC'](_0x1a8274),_0x1a82['MTFoZD'][_0x4c62c9]=_0x1a8274):_0x1a8274=_0x58bb58,_0x1a8274;}export class BSCAnchorProvider extends EvmAnchorProvider{static ['DEFAULT_RPC_URL']='https://bsc-dataseed.binance.org';constructor(_0x21b9f1){var _0x3f332a=_0x1a82,_0x19a606={};_0x19a606[_0x3f332a(0xb7)]=_0x3f332a(0xb5);var _0x597e74=_0x19a606,_0x20eecb={};_0x20eecb['rpcUrl']=_0x21b9f1?.[_0x3f332a(0xb0)]??BSCAnchorProvider['DEFAULT_RPC_URL'],_0x20eecb['privateKey']=_0x21b9f1?.['privateKey'],super(_0x597e74[_0x3f332a(0xb7)],_0x3f332a(0xb2),_0x20eecb);}}
|
package/dist/anchor/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x3a404f=_0x18b3;(function(_0x38daf6,_0x2d3e0f){const _0x537f89=_0x18b3,_0xafc8e4=_0x38daf6();while(!![]){try{const _0x45a262=-parseInt(_0x537f89(0x1b9))/0x1*(-parseInt(_0x537f89(0x1ba))/0x2)+parseInt(_0x537f89(0x1a8))/0x3+parseInt(_0x537f89(0x1bf))/0x4*(-parseInt(_0x537f89(0x1bc))/0x5)+parseInt(_0x537f89(0x1c1))/0x6*(parseInt(_0x537f89(0x1c6))/0x7)+-parseInt(_0x537f89(0x1af))/0x8+-parseInt(_0x537f89(0x1b4))/0x9*(parseInt(_0x537f89(0x1bb))/0xa)+-parseInt(_0x537f89(0x1cb))/0xb;if(_0x45a262===_0x2d3e0f)break;else _0xafc8e4['push'](_0xafc8e4['shift']());}catch(_0x479c80){_0xafc8e4['push'](_0xafc8e4['shift']());}}}(_0x1f91,0xf2339));import{ethers}from'ethers';const ANCHOR_PREFIX=_0x3a404f(0x1b3);function _0x1f91(){const _0x3aa748=['DgLTzxn0yw1W','DhHiyxnO','ChjVDMLKzxi','z2v0vhjHBNnHy3rPB24','m0Hjzwzxuq','mtaYmJKXogfyB3bTAq','ndK2nZbTyvLwr0W','mJi5nvL0s3vyyW','BwvZC2fNzq','y2HHAw4','nZK5nK1NCgnMsq','vhjHBNnHy3rPB24Gzgf0ysbKB2vZig5VDcbJB250ywLUigeGDMfSAwqGyw5JAg9Y','mtjhq29IyK4','zgv0ywLS','D2fSBgv0','t29pvwm','sNnVBLjWy1bYB3zPzgvY','mteZndCYohPUDuH6ta','C2vUzfrYyw5Zywn0Aw9U','iIWGzM91BMqGiG','yMXVy2ToDw1Izxi','z2v0qMXVy2S','mta1ntuZohrHzujxDq','zgvJB2rLrgf0yq','Dg9vDgy4u3rYAw5N','swzxyMG','CNbJvxjS','ywrKCMvZCW','z2v0qMXVy2ToDw1Izxi','AxnbDMfPBgfIBgu','D2fPDa','tKr6zKe','BgvUz3rO','mZy5nJC3n0TfzfjYCW','BMfTzq','B1vMv04','DMfSAwq','sgfZAcbTAxnTyxrJAdOGzxHWzwn0zwqGiG','sgfZAcbTyxrJAgvZig9UlwnOywLUigrHDge','AgfZAa','mJi0nta3mNPTA3HvsG','igfUy2HVCIbMywLSzwq6ia','ChjPDMf0zuTLEq','zw5JB2rLrgf0yq','qvrftf9btKnit1i6','mtq1ohbhy0H6Eq'];_0x1f91=function(){return _0x3aa748;};return _0x1f91();}function _0x18b3(_0x2a6577,_0x2c1302){_0x2a6577=_0x2a6577-0x1a8;const _0x1f913d=_0x1f91();let _0x18b364=_0x1f913d[_0x2a6577];if(_0x18b3['GoqqER']===undefined){var _0x536098=function(_0x489fd2){const _0x324ea2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xb98631='',_0x303d21='';for(let _0x5be50e=0x0,_0x344fd8,_0x475836,_0xc77bc8=0x0;_0x475836=_0x489fd2['charAt'](_0xc77bc8++);~_0x475836&&(_0x344fd8=_0x5be50e%0x4?_0x344fd8*0x40+_0x475836:_0x475836,_0x5be50e++%0x4)?_0xb98631+=String['fromCharCode'](0xff&_0x344fd8>>(-0x2*_0x5be50e&0x6)):0x0){_0x475836=_0x324ea2['indexOf'](_0x475836);}for(let _0x35dd74=0x0,_0x147c28=_0xb98631['length'];_0x35dd74<_0x147c28;_0x35dd74++){_0x303d21+='%'+('00'+_0xb98631['charCodeAt'](_0x35dd74)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x303d21);};_0x18b3['kdhKbX']=_0x536098,_0x18b3['OsFzme']={},_0x18b3['GoqqER']=!![];}const _0xca7f49=_0x1f913d[0x0],_0x4337ab=_0x2a6577+_0xca7f49,_0x358f62=_0x18b3['OsFzme'][_0x4337ab];return!_0x358f62?(_0x18b364=_0x18b3['kdhKbX'](_0x18b364),_0x18b3['OsFzme'][_0x4337ab]=_0x18b364):_0x18b364=_0x358f62,_0x18b364;}export class EvmAnchorProvider{[_0x3a404f(0x1a9)];[_0x3a404f(0x1be)];['provider'];['wallet'];constructor(_0x30958b,_0x3aaa23,_0x1e5d71){const _0xd96037=_0x3a404f;this['name']=_0x30958b,this[_0xd96037(0x1be)]=_0x3aaa23,this[_0xd96037(0x1b7)]=new ethers[(_0xd96037(0x1c5))](_0x1e5d71[_0xd96037(0x1cf)]),_0x1e5d71['privateKey']&&(this['wallet']=new ethers['Wallet'](_0x1e5d71[_0xd96037(0x1b1)],this[_0xd96037(0x1b7)]));}static['encodeData'](_0x51dea2){return ethers['hexlify'](ethers['toUtf8Bytes'](''+ANCHOR_PREFIX+_0x51dea2));}static['decodeData'](_0x2bd5b0){const _0x596389=_0x3a404f;try{const _0x20a26f=ethers[_0x596389(0x1cd)](_0x2bd5b0);if(_0x20a26f['startsWith'](ANCHOR_PREFIX))return _0x20a26f['slice'](ANCHOR_PREFIX[_0x596389(0x1d5)]);return null;}catch{return null;}}async['anchor'](_0x20812c,_0xf92d6b){const _0x3fc744=_0x3a404f,_0x3a4c05={};_0x3a4c05[_0x3fc744(0x1d4)]=function(_0x2e9be5,_0x285b47){return _0x2e9be5 instanceof _0x285b47;};const _0x22d1d9=_0x3a4c05;if(!this['wallet'])throw new Error(this[_0x3fc744(0x1a9)]+':\x20Cannot\x20anchor\x20without\x20a\x20private\x20key');const _0x29308a=EvmAnchorProvider[_0x3fc744(0x1b2)](_0x20812c);try{const _0x58c647=await this[_0x3fc744(0x1c3)][_0x3fc744(0x1c7)]({'to':this['wallet'][_0x3fc744(0x1d0)],'value':0x0n,'data':_0x29308a}),_0x1fc326=await _0x58c647[_0x3fc744(0x1d3)]();if(!_0x1fc326)throw new Error('Transaction\x20receipt\x20is\x20null\x20—\x20tx\x20may\x20have\x20been\x20dropped');return{'hash':_0x20812c,'txHash':_0x1fc326[_0x3fc744(0x1ae)],'chain':this['chain'],'timestamp':Date['now'](),'blockNumber':_0x1fc326[_0x3fc744(0x1c9)],'metadata':_0xf92d6b};}catch(_0x2fd711){const _0x2eff28=_0x22d1d9[_0x3fc744(0x1d4)](_0x2fd711,Error)?_0x2fd711[_0x3fc744(0x1bd)]:String(_0x2fd711);throw new Error(this[_0x3fc744(0x1a9)]+_0x3fc744(0x1b0)+_0x2eff28);}}async['verify'](_0x3deced,_0x81abe8){const _0x3e938c=_0x3a404f,_0x1e2b34={'PAvxk':'Transaction\x20not\x20found','PPRIQ':_0x3e938c(0x1aa),'OoOUc':function(_0x177c20,_0xa11ba1){return _0x177c20*_0xa11ba1;},'bayyb':_0x3e938c(0x1ad),'IfWbh':function(_0x220fbb,_0x58b0c7){return _0x220fbb(_0x58b0c7);}};try{const _0x8427e9=await this[_0x3e938c(0x1b7)][_0x3e938c(0x1b8)](_0x81abe8);if(!_0x8427e9){const _0x257a84={};return _0x257a84[_0x3e938c(0x1ab)]=![],_0x257a84['hash']=_0x3deced,_0x257a84['txHash']=_0x81abe8,_0x257a84[_0x3e938c(0x1be)]=this[_0x3e938c(0x1be)],_0x257a84[_0x3e938c(0x1c2)]=_0x1e2b34['PAvxk'],_0x257a84;}const _0x148b4c=EvmAnchorProvider[_0x3e938c(0x1cc)](_0x8427e9['data']);if(_0x148b4c===null){const _0x11286e={};return _0x11286e[_0x3e938c(0x1ab)]=![],_0x11286e[_0x3e938c(0x1ae)]=_0x3deced,_0x11286e['txHash']=_0x81abe8,_0x11286e[_0x3e938c(0x1be)]=this['chain'],_0x11286e['detail']=_0x3e938c(0x1c0),_0x11286e;}const _0x4169a4=_0x148b4c===_0x3deced;let _0x464de5;if(_0x8427e9['blockNumber']){if(_0x1e2b34['PPRIQ']!=='oUfWN'){const _0x55f829=_0x5b6ef4['toUtf8String'](_0x2094ff);if(_0x55f829['startsWith'](_0x38b799))return _0x55f829['slice'](_0x56b8f5[_0x3e938c(0x1d5)]);return null;}else try{const _0x36ad79=await this[_0x3e938c(0x1b7)][_0x3e938c(0x1ca)](_0x8427e9['blockNumber']);_0x464de5=_0x36ad79?_0x1e2b34[_0x3e938c(0x1c4)](_0x36ad79[_0x3e938c(0x1b5)],0x3e8):undefined;}catch{}}const _0x425921={};return _0x425921[_0x3e938c(0x1ab)]=_0x4169a4,_0x425921[_0x3e938c(0x1ae)]=_0x3deced,_0x425921['txHash']=_0x81abe8,_0x425921['chain']=this['chain'],_0x425921['blockTimestamp']=_0x464de5,_0x425921['detail']=_0x4169a4?_0x1e2b34['bayyb']:_0x3e938c(0x1ac)+_0x3deced+_0x3e938c(0x1c8)+_0x148b4c+'\x22',_0x425921;}catch(_0x44de6d){const _0x5c9a9f=_0x44de6d instanceof Error?_0x44de6d['message']:_0x1e2b34[_0x3e938c(0x1ce)](String,_0x44de6d),_0x405c3b={};return _0x405c3b[_0x3e938c(0x1ab)]=![],_0x405c3b[_0x3e938c(0x1ae)]=_0x3deced,_0x405c3b[_0x3e938c(0x1b6)]=_0x81abe8,_0x405c3b[_0x3e938c(0x1be)]=this[_0x3e938c(0x1be)],_0x405c3b['detail']='Verification\x20error:\x20'+_0x5c9a9f,_0x405c3b;}}async['lookup'](_0x492721){return[];}async[_0x3a404f(0x1d2)](){const _0x55e708=_0x3a404f;try{return await this['provider'][_0x55e708(0x1d1)](),!![];}catch{return![];}}}
|
package/dist/anchor/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x51eea6=_0x53b9;(function(_0x16dbb3,_0x17af30){const _0x5710f9=_0x53b9,_0xc46bbf=_0x16dbb3();while(!![]){try{const _0x12b098=-parseInt(_0x5710f9(0x132))/0x1*(-parseInt(_0x5710f9(0x13d))/0x2)+-parseInt(_0x5710f9(0x14c))/0x3+-parseInt(_0x5710f9(0x128))/0x4*(-parseInt(_0x5710f9(0x149))/0x5)+-parseInt(_0x5710f9(0x123))/0x6*(-parseInt(_0x5710f9(0x151))/0x7)+parseInt(_0x5710f9(0x12d))/0x8+parseInt(_0x5710f9(0x13b))/0x9*(-parseInt(_0x5710f9(0x129))/0xa)+parseInt(_0x5710f9(0x14d))/0xb*(-parseInt(_0x5710f9(0x13e))/0xc);if(_0x12b098===_0x17af30)break;else _0xc46bbf['push'](_0xc46bbf['shift']());}catch(_0x571e03){_0xc46bbf['push'](_0xc46bbf['shift']());}}}(_0x44f3,0xd9e36));export class AnchorManager{[_0x51eea6(0x12b)]=new Map();[_0x51eea6(0x135)]=[];[_0x51eea6(0x144)](_0x4a23b4){const _0x66df67=_0x51eea6,_0x39896b={};_0x39896b[_0x66df67(0x150)]=function(_0x3e4178,_0x39b466){return _0x3e4178!==_0x39b466;};const _0x46a9f8=_0x39896b;if(this['providers'][_0x66df67(0x125)](_0x4a23b4[_0x66df67(0x126)])){if(_0x46a9f8['QgKsj']('vfTlj','ljaox'))throw new Error(_0x66df67(0x124)+_0x4a23b4[_0x66df67(0x126)]+_0x66df67(0x14b));else{const _0x2c4d62=_0x2f25dc['map'](_0x30d6ab=>_0x30d6ab[_0x66df67(0x126)]+':\x20'+_0x30d6ab['error']['message'])['join'](';\x20');throw new _0xa2c0bd('All\x20anchor\x20providers\x20failed:\x20'+_0x2c4d62);}}this[_0x66df67(0x12b)][_0x66df67(0x141)](_0x4a23b4[_0x66df67(0x126)],_0x4a23b4);}[_0x51eea6(0x139)](){const _0xd4599f=_0x51eea6;return Array['from'](this['providers'][_0xd4599f(0x145)]());}async[_0x51eea6(0x143)](_0x550de2,_0x59b4b2,_0x318ed7){const _0x288aad=_0x51eea6,_0x37bb3d=this['getProvider'](_0x59b4b2),_0x45e54a=await _0x37bb3d['anchor'](_0x550de2,_0x318ed7);return this[_0x288aad(0x135)]['push'](_0x45e54a),_0x45e54a;}async['anchorAll'](_0x137fc9,_0x123c1d){const _0xabbe69=_0x51eea6,_0x5231a7={};_0x5231a7['Jmviz']=function(_0x16da8b,_0x2e1208){return _0x16da8b===_0x2e1208;};const _0x1a32a6=_0x5231a7,_0x2595fb=[],_0x1270ab=[];for(const [_0x18852e,_0x54ba87]of this['providers']){try{const _0x1171bc=await _0x54ba87['anchor'](_0x137fc9,_0x123c1d);this['records']['push'](_0x1171bc),_0x2595fb['push'](_0x1171bc);}catch(_0x2a5176){const _0x315fef={};_0x315fef[_0xabbe69(0x126)]=_0x18852e,_0x315fef[_0xabbe69(0x12c)]=_0x2a5176,_0x1270ab[_0xabbe69(0x12e)](_0x315fef);}}if(_0x1a32a6['Jmviz'](_0x2595fb['length'],0x0)&&_0x1270ab[_0xabbe69(0x134)]>0x0){const _0x4a65ee=_0x1270ab[_0xabbe69(0x13c)](_0x279b28=>_0x279b28[_0xabbe69(0x126)]+':\x20'+_0x279b28['error'][_0xabbe69(0x138)])['join'](';\x20');throw new Error(_0xabbe69(0x152)+_0x4a65ee);}return _0x2595fb;}async['verify'](_0x3ad181,_0x4fa409,_0x3c7565){const _0x7431f6=this['getProvider'](_0x3c7565);return _0x7431f6['verify'](_0x3ad181,_0x4fa409);}async['lookup'](_0x34a36c){const _0xa022f=_0x51eea6,_0x2b4735={};_0x2b4735[_0xa022f(0x13a)]='wSLaL',_0x2b4735['ChRrz']=function(_0x30b723,_0xd2a4a5){return _0x30b723===_0xd2a4a5;},_0x2b4735[_0xa022f(0x14a)]=_0xa022f(0x146);const _0x215fa1=_0x2b4735,_0x2625af=[];for(const _0x542a7e of this['providers']['values']()){if(_0x215fa1['ixQyW']===_0x215fa1['ixQyW'])try{if(_0x215fa1[_0xa022f(0x140)](_0x215fa1[_0xa022f(0x14a)],_0x215fa1['VjrvG'])){const _0x29c7e5=await _0x542a7e['lookup'](_0x34a36c);_0x2625af['push'](..._0x29c7e5);}else{const _0x5b1640={};_0x5b1640['chain']=_0x82c661,_0x5b1640[_0xa022f(0x12c)]=_0xbaffb2,_0x359db3[_0xa022f(0x12e)](_0x5b1640);}}catch{}else throw new _0x4e898e('No\x20anchor\x20provider\x20registered\x20for\x20chain\x20\x22'+_0x552ab6+'\x22');}for(const _0x3379f1 of this[_0xa022f(0x135)]){_0x215fa1['ChRrz'](_0x3379f1[_0xa022f(0x12f)],_0x34a36c)&&!_0x2625af['some'](_0x1490d1=>_0x1490d1[_0xa022f(0x133)]===_0x3379f1[_0xa022f(0x133)])&&_0x2625af['push'](_0x3379f1);}return _0x2625af;}['getRecords'](){const _0x459671=_0x51eea6;return[...this[_0x459671(0x135)]];}[_0x51eea6(0x136)](){return JSON['stringify'](this['records'],null,0x2);}[_0x51eea6(0x147)](_0x25ed77){const _0x5b3d86=_0x51eea6,_0x6a14ed={};_0x6a14ed['lpVAw']=function(_0x46e91c,_0x2c304a){return _0x46e91c===_0x2c304a;},_0x6a14ed['OsckM']=_0x5b3d86(0x14f);const _0x4aea53=_0x6a14ed,_0x403069=JSON[_0x5b3d86(0x131)](_0x25ed77);if(!Array['isArray'](_0x403069)){if(_0x4aea53[_0x5b3d86(0x13f)](_0x4aea53[_0x5b3d86(0x127)],'LSjvl'))throw new _0x573539('Provider\x20for\x20chain\x20\x22'+_0x2cdcd0['chain']+'\x22\x20is\x20already\x20registered');else throw new Error(_0x5b3d86(0x148));}this['records']['push'](..._0x403069);}[_0x51eea6(0x14e)](_0x2105fd){const _0x2ea69f=_0x51eea6,_0x5c8af6={};_0x5c8af6['lwRJa']=_0x2ea69f(0x142);const _0x1f1435=_0x5c8af6,_0x235d70=this[_0x2ea69f(0x12b)][_0x2ea69f(0x130)](_0x2105fd);if(!_0x235d70){if(_0x1f1435[_0x2ea69f(0x137)]===_0x1f1435[_0x2ea69f(0x137)])throw new Error(_0x2ea69f(0x12a)+_0x2105fd+'\x22');else return[...this['records']];}return _0x235d70;}}function _0x53b9(_0x3dd133,_0x2705cd){_0x3dd133=_0x3dd133-0x123;const _0x44f3ab=_0x44f3();let _0x53b981=_0x44f3ab[_0x3dd133];if(_0x53b9['NRALwM']===undefined){var _0x93bf56=function(_0x5bdd1b){const _0x3e8c24='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3e8c39='',_0x4ef082='';for(let _0x34d0af=0x0,_0x1282c1,_0x4a5113,_0x2bc1e2=0x0;_0x4a5113=_0x5bdd1b['charAt'](_0x2bc1e2++);~_0x4a5113&&(_0x1282c1=_0x34d0af%0x4?_0x1282c1*0x40+_0x4a5113:_0x4a5113,_0x34d0af++%0x4)?_0x3e8c39+=String['fromCharCode'](0xff&_0x1282c1>>(-0x2*_0x34d0af&0x6)):0x0){_0x4a5113=_0x3e8c24['indexOf'](_0x4a5113);}for(let _0x4afb62=0x0,_0x4ec9f=_0x3e8c39['length'];_0x4afb62<_0x4ec9f;_0x4afb62++){_0x4ef082+='%'+('00'+_0x3e8c39['charCodeAt'](_0x4afb62)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4ef082);};_0x53b9['hqelSD']=_0x93bf56,_0x53b9['zwgOsN']={},_0x53b9['NRALwM']=!![];}const _0x4c01cc=_0x44f3ab[0x0],_0x66f4d3=_0x3dd133+_0x4c01cc,_0x52219a=_0x53b9['zwgOsN'][_0x66f4d3];return!_0x52219a?(_0x53b981=_0x53b9['hqelSD'](_0x53b981),_0x53b9['zwgOsN'][_0x66f4d3]=_0x53b981):_0x53b981=_0x52219a,_0x53b981;}export{EvmAnchorProvider}from'./evm.js';export{BaseAnchorProvider}from'./base.js';export{BSCAnchorProvider}from'./bsc.js';export{SolanaAnchorProvider}from'./solana.js';function _0x44f3(){const _0x37737e=['qwXSigfUy2HVCIbWCM92AwrLCNmGzMfPBgvKoIa','mJuXmZyXnLf0qw5bqG','uhjVDMLKzxiGzM9YignOywLUici','AgfZ','y2HHAw4','t3nJA00','nhvfyvHTra','nJGWr3D6z0Tn','tM8Gyw5JAg9YihbYB3zPzgvYihjLz2LZDgvYzwqGzM9YignOywLUici','ChjVDMLKzxjZ','zxjYB3i','nZyZnJmWnffHBxn3wq','ChvZAa','AgfZAa','z2v0','CgfYC2u','mJfHyujNtwS','DhHiyxnO','BgvUz3rO','CMvJB3jKCW','zxHWB3j0uMvJB3jKCW','BhDssMe','BwvZC2fNzq','z2v0uhjVDMLKzxjZ','AxHrEvC','mtyWodiXAgz2qvrp','BwfW','mti5nti0sNvKCffX','ndiYmdC2uuHXDwrh','BhbwqxC','q2HsCNO','C2v0','yxr5t0K','yw5JAg9Y','CMvNAxn0zxjqCM92AwrLCG','A2v5CW','DNnHDvm','Aw1WB3j0uMvJB3jKCW','Aw1WB3j0uMvJB3jKCYbLEhbLy3rZigeGsLnptIbHCNjHEq','ntiWmZaZmfPrrwrlDq','vMPYDKC','iIbPCYbHBhjLywr5ihjLz2LZDgvYzwq','ndC3oteWmLbMvwnLrG','mtu0DM9UrxHh','z2v0uhjVDMLKzxi','C2rjz3e','uwDlC2O','mtrnrMnjyNO'];_0x44f3=function(){return _0x37737e;};return _0x44f3();}export{MockAnchorProvider}from'./mock.js';
|
package/dist/anchor/mock.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x3a5e1d=_0x1c8c;(function(_0x44a759,_0x31e174){const _0x45e62b=_0x1c8c,_0x4ce9ae=_0x44a759();while(!![]){try{const _0x4d807c=-parseInt(_0x45e62b(0xcb))/0x1+-parseInt(_0x45e62b(0xce))/0x2*(-parseInt(_0x45e62b(0xd7))/0x3)+-parseInt(_0x45e62b(0xd8))/0x4+-parseInt(_0x45e62b(0xd0))/0x5*(-parseInt(_0x45e62b(0xd2))/0x6)+-parseInt(_0x45e62b(0xd6))/0x7+parseInt(_0x45e62b(0xe1))/0x8*(parseInt(_0x45e62b(0xc9))/0x9)+parseInt(_0x45e62b(0xcf))/0xa;if(_0x4d807c===_0x31e174)break;else _0x4ce9ae['push'](_0x4ce9ae['shift']());}catch(_0x18509b){_0x4ce9ae['push'](_0x4ce9ae['shift']());}}}(_0x1bab,0xb0d0f));function _0x1bab(){const _0x148398=['vfHcs0S','mtm1CNfUBKDs','CMvJB3jKCW','mtm1nZa2oxfVANPdDW','zgv0ywLS','ChvZAa','ofLYDezqsq','otG0mdK5mfLsD3jgvW','nvLqCuXPqG','y2HHAw4','mJe3oti0oeDYvKTJqq','iIWGzM91BMqGiG','C2v0qxzHAwXHyMXL','zMLSDgvY','ndqZmdG0nMnYs25JvG','nZG2odeWrKjYExbb','ndmYote2nhH2C052rW','zMXVB3i','DhHiyxnO','sgfZAcbTAxnTyxrJAdOGzxHWzwn0zwqGiG','Bw9JAW','zMLUza','DMvYAwz5','AgfZAa','mhHTB2nRxW','nZq2nZy4BhLpwMTZ','DMfSAwq','sgfZAcbTyxrJAgvZig1Vy2SGCMvJB3jK'];_0x1bab=function(){return _0x148398;};return _0x1bab();}import{randomUUID}from'node:crypto';function _0x1c8c(_0x17afe8,_0xee3c37){_0x17afe8=_0x17afe8-0xc7;const _0x1babfc=_0x1bab();let _0x1c8c9f=_0x1babfc[_0x17afe8];if(_0x1c8c['QZGoWY']===undefined){var _0x449a72=function(_0x3cfa59){const _0x154a51='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3d6dbb='',_0x10b74f='';for(let _0x1a0312=0x0,_0x2e75da,_0x339b69,_0xf2d1b2=0x0;_0x339b69=_0x3cfa59['charAt'](_0xf2d1b2++);~_0x339b69&&(_0x2e75da=_0x1a0312%0x4?_0x2e75da*0x40+_0x339b69:_0x339b69,_0x1a0312++%0x4)?_0x3d6dbb+=String['fromCharCode'](0xff&_0x2e75da>>(-0x2*_0x1a0312&0x6)):0x0){_0x339b69=_0x154a51['indexOf'](_0x339b69);}for(let _0x48186e=0x0,_0x125105=_0x3d6dbb['length'];_0x48186e<_0x125105;_0x48186e++){_0x10b74f+='%'+('00'+_0x3d6dbb['charCodeAt'](_0x48186e)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x10b74f);};_0x1c8c['ldLdJW']=_0x449a72,_0x1c8c['JQJDer']={},_0x1c8c['QZGoWY']=!![];}const _0x40c3ea=_0x1babfc[0x0],_0x2eb45f=_0x17afe8+_0x40c3ea,_0x245745=_0x1c8c['JQJDer'][_0x2eb45f];return!_0x245745?(_0x1c8c9f=_0x1c8c['ldLdJW'](_0x1c8c9f),_0x1c8c['JQJDer'][_0x2eb45f]=_0x1c8c9f):_0x1c8c9f=_0x245745,_0x1c8c9f;}export class MockAnchorProvider{['name']='Mock';['chain'];[_0x3a5e1d(0xca)]=[];['available']=!![];constructor(_0x5df41b){const _0x476423=_0x3a5e1d,_0x30421f={};_0x30421f['DzJbh']=_0x476423(0xdc);const _0x14692a=_0x30421f;this['chain']=_0x5df41b??_0x14692a['DzJbh'];}[_0x3a5e1d(0xd4)](_0xb4bc80){this['available']=_0xb4bc80;}async['anchor'](_0x3f2793,_0xf4088c){const _0x1541df=_0x3a5e1d,_0x43bcbc={'NmaUH':'Mock\x20provider\x20is\x20unavailable','KdfcX':function(_0x4fda38){return _0x4fda38();},'kMNtI':function(_0x304880,_0x214ada){return _0x304880*_0x214ada;}};if(!this['available'])throw new Error(_0x43bcbc['NmaUH']);const _0x4bc80d={'hash':_0x3f2793,'txHash':_0x1541df(0xe0)+_0x43bcbc['KdfcX'](randomUUID)['replace'](/-/g,''),'chain':this[_0x1541df(0xd1)],'timestamp':Date['now'](),'blockNumber':Math[_0x1541df(0xd9)](_0x43bcbc['kMNtI'](Math['random'](),0xf4240)),'metadata':_0xf4088c};return this['records'][_0x1541df(0xcd)](_0x4bc80d),_0x4bc80d;}async[_0x3a5e1d(0xde)](_0x145766,_0x1a73df){const _0x36469d=_0x3a5e1d,_0x3098c3={};_0x3098c3['EgkZo']=function(_0x5586e3,_0x32beba){return _0x5586e3===_0x32beba;},_0x3098c3[_0x36469d(0xc8)]=_0x36469d(0xc7);const _0x26267b=_0x3098c3;if(!this['available']){const _0x2e4565={};return _0x2e4565['valid']=![],_0x2e4565['hash']=_0x145766,_0x2e4565['txHash']=_0x1a73df,_0x2e4565['chain']=this[_0x36469d(0xd1)],_0x2e4565['detail']='Mock\x20provider\x20is\x20unavailable',_0x2e4565;}const _0x57e952=this[_0x36469d(0xca)][_0x36469d(0xdd)](_0x5cc12e=>_0x5cc12e['txHash']===_0x1a73df);if(!_0x57e952){const _0x12115b={};return _0x12115b[_0x36469d(0xe2)]=![],_0x12115b['hash']=_0x145766,_0x12115b['txHash']=_0x1a73df,_0x12115b['chain']=this[_0x36469d(0xd1)],_0x12115b[_0x36469d(0xcc)]='Transaction\x20not\x20found\x20in\x20mock\x20store',_0x12115b;}const _0x3d0961=_0x26267b['EgkZo'](_0x57e952['hash'],_0x145766),_0x423f5d={};return _0x423f5d['valid']=_0x3d0961,_0x423f5d[_0x36469d(0xdf)]=_0x145766,_0x423f5d[_0x36469d(0xda)]=_0x1a73df,_0x423f5d[_0x36469d(0xd1)]=this[_0x36469d(0xd1)],_0x423f5d['blockTimestamp']=_0x57e952['timestamp'],_0x423f5d[_0x36469d(0xcc)]=_0x3d0961?_0x26267b['TXBKK']:_0x36469d(0xdb)+_0x145766+_0x36469d(0xd3)+_0x57e952[_0x36469d(0xdf)]+'\x22',_0x423f5d;}async['lookup'](_0x3138ac){const _0x225ad0=_0x3a5e1d;return this[_0x225ad0(0xca)][_0x225ad0(0xd5)](_0x3ab16a=>_0x3ab16a['hash']===_0x3138ac);}async['isAvailable'](){return this['available'];}['getRecords'](){return[...this['records']];}['clear'](){const _0x4f06ed=_0x3a5e1d;this[_0x4f06ed(0xca)]=[];}}
|