@lawrenceliang-btc/atel-sdk 1.2.13 → 1.2.15
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/README.md +8 -10
- package/bin/atel.mjs +188 -87
- package/bin/notification-action-helpers.mjs +76 -16
- package/dist/anchor/index.d.ts +2 -3
- package/dist/anchor/index.js +1 -2
- package/dist/endpoint/index.d.ts +0 -2
- package/dist/handshake/index.d.ts +0 -8
- package/package.json +1 -2
- package/skill/atel-agent/SKILL.md +1 -1
- package/skill/references/commercial.md +3 -14
- package/skill/references/executor.md +1 -1
- package/skill/references/onchain.md +7 -3
- package/skill/references/quickstart.md +1 -5
- package/skill/references/security.md +1 -1
- package/skill/references/workflows.md +1 -1
- package/dist/anchor/solana.d.ts +0 -95
- package/dist/anchor/solana.js +0 -298
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
export function explainDirectExecutionSkip(eventType, recommendedActions, payload = {}, policy = {}) {
|
|
2
|
+
if (eventType !== 'order_created') return '';
|
|
3
|
+
if (!Array.isArray(recommendedActions) || recommendedActions.length === 0) return 'missing_recommended_actions';
|
|
4
|
+
const hasAcceptAction = recommendedActions.some((action) =>
|
|
5
|
+
action?.type === 'cli' &&
|
|
6
|
+
action?.action === 'accept' &&
|
|
7
|
+
Array.isArray(action.command) &&
|
|
8
|
+
action.command[0] === 'atel'
|
|
9
|
+
);
|
|
10
|
+
if (!hasAcceptAction) return 'missing_accept_action';
|
|
11
|
+
const amount = Number(payload?.priceAmount || 0);
|
|
12
|
+
const autoPolicy = policy?.autoPolicy || {};
|
|
13
|
+
const acceptMaxAmount = Number(autoPolicy.acceptMaxAmount || 0);
|
|
14
|
+
if (amount <= 0) {
|
|
15
|
+
if (policy?.taskMode !== 'auto') return 'task_mode_not_auto';
|
|
16
|
+
if (policy?.autoAcceptPlatform !== true) return 'auto_accept_platform_disabled';
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
if (autoPolicy.acceptOrders !== true) return 'paid_auto_accept_disabled';
|
|
20
|
+
if (acceptMaxAmount > 0 && amount > acceptMaxAmount) return 'price_exceeds_accept_max';
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
|
|
1
24
|
export function getDirectExecutableActions(eventType, recommendedActions, payload = {}, policy = {}) {
|
|
2
25
|
if (!Array.isArray(recommendedActions) || recommendedActions.length === 0) return [];
|
|
3
26
|
|
|
@@ -34,11 +57,13 @@ export function shouldSkipAgentHook(eventType, directExecutionSucceeded) {
|
|
|
34
57
|
return eventType === 'order_accepted' && directExecutionSucceeded;
|
|
35
58
|
}
|
|
36
59
|
|
|
60
|
+
const EXECUTOR_MILESTONE_EVENTS = new Set(['milestone_plan_confirmed', 'milestone_verified', 'milestone_rejected']);
|
|
61
|
+
|
|
37
62
|
export function shouldUseGatewaySession(eventType) {
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
return eventType === 'p2p_task';
|
|
63
|
+
// Use isolated gateway sub-sessions for milestone executor turns so each
|
|
64
|
+
// order+milestone attempt runs in a clean room instead of sharing the main
|
|
65
|
+
// agent runtime context.
|
|
66
|
+
return eventType === 'p2p_task' || EXECUTOR_MILESTONE_EVENTS.has(eventType);
|
|
42
67
|
}
|
|
43
68
|
|
|
44
69
|
export function normalizeGatewayBind(bind) {
|
|
@@ -58,6 +83,44 @@ function normalizeResult(value) {
|
|
|
58
83
|
return value.trim();
|
|
59
84
|
}
|
|
60
85
|
|
|
86
|
+
function normalizeOrderId(value) {
|
|
87
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function extractForeignOrderId(text, expectedOrderId) {
|
|
91
|
+
const current = normalizeOrderId(expectedOrderId);
|
|
92
|
+
if (!current) return '';
|
|
93
|
+
const found = Array.from(String(text || '').matchAll(/ord-[a-f0-9-]+/g)).map((m) => m[0]);
|
|
94
|
+
return found.find((item) => item !== current) || '';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function validateExecutorMilestoneBody(eventType, payload, body) {
|
|
98
|
+
if (!EXECUTOR_MILESTONE_EVENTS.has(eventType)) return { ok: true };
|
|
99
|
+
const expectedOrderId = normalizeOrderId(payload?.orderId);
|
|
100
|
+
if (!expectedOrderId) return { ok: false, error: 'missing_order_id' };
|
|
101
|
+
const actualOrderId = normalizeOrderId(body?.orderId);
|
|
102
|
+
if (!actualOrderId) return { ok: false, error: 'missing_result_order_id' };
|
|
103
|
+
if (actualOrderId !== expectedOrderId) return { ok: false, error: 'mismatched_result_order_id' };
|
|
104
|
+
|
|
105
|
+
const expectedIndex = eventType === 'milestone_plan_confirmed'
|
|
106
|
+
? normalizeIndex(payload?.milestoneIndex, 0)
|
|
107
|
+
: normalizeIndex(payload?.currentMilestone ?? payload?.milestoneIndex, 0);
|
|
108
|
+
if (!Number.isFinite(Number(body?.milestoneIndex))) return { ok: false, error: 'missing_result_milestone_index' };
|
|
109
|
+
const actualIndex = normalizeIndex(body?.milestoneIndex, -1);
|
|
110
|
+
if (actualIndex !== expectedIndex) return { ok: false, error: 'mismatched_result_milestone_index' };
|
|
111
|
+
|
|
112
|
+
const result = normalizeResult(body?.result || body?.summary);
|
|
113
|
+
if (!result) return { ok: false, error: 'missing_result' };
|
|
114
|
+
const lowered = result.toLowerCase();
|
|
115
|
+
if (lowered.includes('invalid_cross_order_reference')) return { ok: false, error: 'invalid_cross_order_reference' };
|
|
116
|
+
if (lowered.includes('context overflow')) return { ok: false, error: 'context_overflow_output' };
|
|
117
|
+
if (lowered.includes('plugin register() called') || lowered.includes('plugin registration complete')) return { ok: false, error: 'plugin_noise_output' };
|
|
118
|
+
if (lowered.includes('session file locked') || lowered.includes('session locked')) return { ok: false, error: 'session_locked_output' };
|
|
119
|
+
const foreign = extractForeignOrderId(result, expectedOrderId);
|
|
120
|
+
if (foreign) return { ok: false, error: 'foreign_order_reference_detected' };
|
|
121
|
+
return { ok: true, result, orderId: expectedOrderId, milestoneIndex: expectedIndex };
|
|
122
|
+
}
|
|
123
|
+
|
|
61
124
|
export function buildAgentCallbackAction(eventType, payload, body) {
|
|
62
125
|
if (eventType === 'p2p_task') {
|
|
63
126
|
const taskId = payload?.taskId;
|
|
@@ -79,44 +142,41 @@ export function buildAgentCallbackAction(eventType, payload, body) {
|
|
|
79
142
|
if (!orderId) return { ok: false, error: 'missing_order_id' };
|
|
80
143
|
|
|
81
144
|
if (eventType === 'milestone_plan_confirmed') {
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
84
|
-
const index = normalizeIndex(payload?.milestoneIndex, 0);
|
|
145
|
+
const validated = validateExecutorMilestoneBody(eventType, payload, body);
|
|
146
|
+
if (!validated.ok) return validated;
|
|
85
147
|
return {
|
|
86
148
|
ok: true,
|
|
87
149
|
action: {
|
|
88
150
|
type: 'cli',
|
|
89
151
|
action: 'submit_milestone',
|
|
90
|
-
command: ['atel', 'milestone-submit', orderId, String(
|
|
152
|
+
command: ['atel', 'milestone-submit', orderId, String(validated.milestoneIndex), '--result', validated.result],
|
|
91
153
|
},
|
|
92
154
|
};
|
|
93
155
|
}
|
|
94
156
|
|
|
95
157
|
if (eventType === 'milestone_verified') {
|
|
96
158
|
if (payload?.allComplete) return { ok: false, skipped: true, reason: 'all_complete' };
|
|
97
|
-
const
|
|
98
|
-
if (!
|
|
99
|
-
const index = normalizeIndex(payload?.currentMilestone, 0);
|
|
159
|
+
const validated = validateExecutorMilestoneBody(eventType, payload, body);
|
|
160
|
+
if (!validated.ok) return validated;
|
|
100
161
|
return {
|
|
101
162
|
ok: true,
|
|
102
163
|
action: {
|
|
103
164
|
type: 'cli',
|
|
104
165
|
action: 'submit_milestone',
|
|
105
|
-
command: ['atel', 'milestone-submit', orderId, String(
|
|
166
|
+
command: ['atel', 'milestone-submit', orderId, String(validated.milestoneIndex), '--result', validated.result],
|
|
106
167
|
},
|
|
107
168
|
};
|
|
108
169
|
}
|
|
109
170
|
|
|
110
171
|
if (eventType === 'milestone_rejected') {
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
const index = normalizeIndex(payload?.milestoneIndex, 0);
|
|
172
|
+
const validated = validateExecutorMilestoneBody(eventType, payload, body);
|
|
173
|
+
if (!validated.ok) return validated;
|
|
114
174
|
return {
|
|
115
175
|
ok: true,
|
|
116
176
|
action: {
|
|
117
177
|
type: 'cli',
|
|
118
178
|
action: 'resubmit',
|
|
119
|
-
command: ['atel', 'milestone-submit', orderId, String(
|
|
179
|
+
command: ['atel', 'milestone-submit', orderId, String(validated.milestoneIndex), '--result', validated.result],
|
|
120
180
|
},
|
|
121
181
|
};
|
|
122
182
|
}
|
package/dist/anchor/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* (proof_id, trace_root, etc.) on public blockchains for tamper-evident
|
|
6
6
|
* timestamping and auditability.
|
|
7
7
|
*
|
|
8
|
-
* Supported chains: Base (EVM)
|
|
8
|
+
* Supported chains: Base (EVM) and BSC (EVM).
|
|
9
9
|
* A MockAnchorProvider is included for testing without real chain access.
|
|
10
10
|
*/
|
|
11
11
|
/** Supported chain identifiers */
|
|
12
|
-
export type ChainId = 'base' | '
|
|
12
|
+
export type ChainId = 'base' | 'bsc' | 'mock';
|
|
13
13
|
/**
|
|
14
14
|
* A record of a hash anchored on-chain.
|
|
15
15
|
*/
|
|
@@ -169,5 +169,4 @@ export declare class AnchorManager {
|
|
|
169
169
|
export { EvmAnchorProvider, type EvmAnchorConfig, type EvmAnchorMemoV2 } from './evm.js';
|
|
170
170
|
export { BaseAnchorProvider } from './base.js';
|
|
171
171
|
export { BSCAnchorProvider } from './bsc.js';
|
|
172
|
-
export { SolanaAnchorProvider, type SolanaAnchorConfig, type AnchorMemoV2 } from './solana.js';
|
|
173
172
|
export { MockAnchorProvider } from './mock.js';
|
package/dist/anchor/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* (proof_id, trace_root, etc.) on public blockchains for tamper-evident
|
|
6
6
|
* timestamping and auditability.
|
|
7
7
|
*
|
|
8
|
-
* Supported chains: Base (EVM)
|
|
8
|
+
* Supported chains: Base (EVM) and BSC (EVM).
|
|
9
9
|
* A MockAnchorProvider is included for testing without real chain access.
|
|
10
10
|
*/
|
|
11
11
|
// ─── AnchorManager ───────────────────────────────────────────────
|
|
@@ -161,5 +161,4 @@ export class AnchorManager {
|
|
|
161
161
|
export { EvmAnchorProvider } from './evm.js';
|
|
162
162
|
export { BaseAnchorProvider } from './base.js';
|
|
163
163
|
export { BSCAnchorProvider } from './bsc.js';
|
|
164
|
-
export { SolanaAnchorProvider } from './solana.js';
|
|
165
164
|
export { MockAnchorProvider } from './mock.js';
|
package/dist/endpoint/index.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ export interface EndpointConfig {
|
|
|
55
55
|
rateLimit?: RateLimitConfig;
|
|
56
56
|
/** Wallet addresses for on-chain trust verification during handshake */
|
|
57
57
|
wallets?: {
|
|
58
|
-
solana?: string;
|
|
59
58
|
base?: string;
|
|
60
59
|
bsc?: string;
|
|
61
60
|
};
|
|
@@ -124,7 +123,6 @@ export declare class AgentClient {
|
|
|
124
123
|
* Establishes both identity verification and E2E encryption.
|
|
125
124
|
*/
|
|
126
125
|
handshake(remoteEndpoint: string, handshakeManager: HandshakeManager, remoteDid: string, wallets?: {
|
|
127
|
-
solana?: string;
|
|
128
126
|
base?: string;
|
|
129
127
|
bsc?: string;
|
|
130
128
|
}): Promise<import('../handshake/index.js').Session>;
|
|
@@ -16,7 +16,6 @@ import { EncryptionManager } from '../crypto/index.js';
|
|
|
16
16
|
/** Wallet addresses with DID-signed proof of ownership */
|
|
17
17
|
export interface WalletBundle {
|
|
18
18
|
addresses: {
|
|
19
|
-
solana?: string;
|
|
20
19
|
base?: string;
|
|
21
20
|
bsc?: string;
|
|
22
21
|
};
|
|
@@ -32,7 +31,6 @@ export interface HandshakeInitPayload {
|
|
|
32
31
|
capabilities?: string[];
|
|
33
32
|
/** Wallet addresses for on-chain trust verification */
|
|
34
33
|
wallets?: {
|
|
35
|
-
solana?: string;
|
|
36
34
|
base?: string;
|
|
37
35
|
bsc?: string;
|
|
38
36
|
};
|
|
@@ -49,7 +47,6 @@ export interface HandshakeAckPayload {
|
|
|
49
47
|
capabilities?: string[];
|
|
50
48
|
/** Wallet addresses for on-chain trust verification */
|
|
51
49
|
wallets?: {
|
|
52
|
-
solana?: string;
|
|
53
50
|
base?: string;
|
|
54
51
|
bsc?: string;
|
|
55
52
|
};
|
|
@@ -76,7 +73,6 @@ export interface Session {
|
|
|
76
73
|
remoteCapabilities?: string[];
|
|
77
74
|
/** Remote agent's wallet addresses (if provided) */
|
|
78
75
|
remoteWallets?: {
|
|
79
|
-
solana?: string;
|
|
80
76
|
base?: string;
|
|
81
77
|
bsc?: string;
|
|
82
78
|
};
|
|
@@ -103,7 +99,6 @@ export declare class HandshakeError extends Error {
|
|
|
103
99
|
}
|
|
104
100
|
/** Create a signed wallet bundle proving DID ownership of wallet addresses */
|
|
105
101
|
export declare function createWalletBundle(addresses: {
|
|
106
|
-
solana?: string;
|
|
107
102
|
base?: string;
|
|
108
103
|
bsc?: string;
|
|
109
104
|
}, secretKey: Uint8Array): WalletBundle;
|
|
@@ -131,7 +126,6 @@ export declare class HandshakeManager {
|
|
|
131
126
|
* Create a handshake_init message (Step 1).
|
|
132
127
|
*/
|
|
133
128
|
createInit(remoteDid: string, wallets?: {
|
|
134
|
-
solana?: string;
|
|
135
129
|
base?: string;
|
|
136
130
|
bsc?: string;
|
|
137
131
|
}): ATELMessage<HandshakeInitPayload>;
|
|
@@ -146,7 +140,6 @@ export declare class HandshakeManager {
|
|
|
146
140
|
* Process a handshake_init message and create handshake_ack (Step 2).
|
|
147
141
|
*/
|
|
148
142
|
processInit(initMessage: ATELMessage<HandshakeInitPayload>, wallets?: {
|
|
149
|
-
solana?: string;
|
|
150
143
|
base?: string;
|
|
151
144
|
bsc?: string;
|
|
152
145
|
}): ATELMessage<HandshakeAckPayload>;
|
|
@@ -154,7 +147,6 @@ export declare class HandshakeManager {
|
|
|
154
147
|
* Process a handshake_confirm message (Step 3, responder side).
|
|
155
148
|
*/
|
|
156
149
|
processConfirm(confirmMessage: ATELMessage<HandshakeConfirmPayload>, initiatorPublicKey: Uint8Array, initiatorCapabilities?: string[], initiatorWallets?: {
|
|
157
|
-
solana?: string;
|
|
158
150
|
base?: string;
|
|
159
151
|
bsc?: string;
|
|
160
152
|
}, initiatorWalletBundle?: WalletBundle): Session;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lawrenceliang-btc/atel-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.15",
|
|
4
4
|
"description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"prepublishOnly": "npm run clean && npm run build && npm test"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/web3.js": "^1.98.4",
|
|
53
52
|
"ajv": "^8.17.1",
|
|
54
53
|
"ajv-formats": "^3.0.1",
|
|
55
54
|
"bs58": "^6.0.0",
|
|
@@ -523,7 +523,7 @@ atel withdraw 5 crypto_bsc <外部钱包地址> # 提现到用户的外部钱
|
|
|
523
523
|
atel transactions # 交易记录
|
|
524
524
|
```
|
|
525
525
|
|
|
526
|
-
支持的充值渠道:`
|
|
526
|
+
支持的充值渠道:`crypto_base`、`crypto_bsc`、`stripe`、`alipay`、`manual`
|
|
527
527
|
|
|
528
528
|
### 提现流程
|
|
529
529
|
|
|
@@ -33,27 +33,16 @@ Minimum commission: 0.5%. Free orders (price=0) have no commission.
|
|
|
33
33
|
## Payment Channels
|
|
34
34
|
|
|
35
35
|
- `manual` — Transfer and contact admin for confirmation
|
|
36
|
-
- `crypto_solana` — Solana on-chain deposit (auto-verified)
|
|
37
36
|
- `crypto_base` — Base chain deposit (auto-verified)
|
|
38
37
|
- `crypto_bsc` — BSC deposit (auto-verified)
|
|
39
38
|
|
|
40
|
-
### Solana deposit warning
|
|
41
|
-
|
|
42
|
-
If guiding the owner to deposit USDC on Solana, explicitly tell them the transfer must use **`transferChecked`**.
|
|
43
|
-
Do not describe plain `transfer` as acceptable for Solana USDC deposits.
|
|
44
|
-
|
|
45
|
-
Operational rule:
|
|
46
|
-
- when suggesting or explaining Solana USDC deposit steps, explicitly state that `transferChecked` is required
|
|
47
|
-
- if a Solana deposit is pending but not recognized, check whether the user sent USDC with `transfer` instead of `transferChecked`
|
|
48
|
-
- if the owner cannot ensure `transferChecked`, prefer recommending `crypto_base` or `crypto_bsc` instead of giving risky Solana instructions
|
|
49
|
-
|
|
50
39
|
### Deposit Info API
|
|
51
40
|
|
|
52
41
|
Get platform deposit addresses (no auth required):
|
|
53
42
|
|
|
54
43
|
```bash
|
|
55
44
|
curl https://api.atelai.org/account/v1/deposit-info
|
|
56
|
-
# Returns: { "chains": [{ "chain": "
|
|
45
|
+
# Returns: { "chains": [{ "chain": "base", "address": "...", "minAmount": 5 }, ...] }
|
|
57
46
|
```
|
|
58
47
|
|
|
59
48
|
## Marketplace
|
|
@@ -139,8 +128,8 @@ Agents can withdraw funds from their platform balance:
|
|
|
139
128
|
# Withdraw to Base wallet (instant on-chain transfer)
|
|
140
129
|
atel withdraw 50 crypto_base 0xYOUR_WALLET_ADDRESS
|
|
141
130
|
|
|
142
|
-
# Withdraw to
|
|
143
|
-
atel withdraw 50
|
|
131
|
+
# Withdraw to Base wallet (instant on-chain transfer)
|
|
132
|
+
atel withdraw 50 crypto_base YOUR_BASE_ADDRESS
|
|
144
133
|
|
|
145
134
|
# Withdraw to BSC wallet (instant on-chain transfer)
|
|
146
135
|
atel withdraw 50 crypto_bsc YOUR_BSC_ADDRESS
|
|
@@ -355,7 +355,7 @@ and pay gas). You do not need to configure any chain private key to receive
|
|
|
355
355
|
paid orders.
|
|
356
356
|
|
|
357
357
|
Legacy V1 behaviour (opt-in only, not recommended): if `atel anchor config` was
|
|
358
|
-
run, the SDK will also detect `
|
|
358
|
+
run, the SDK will also detect `ATEL_BASE_PRIVATE_KEY`,
|
|
359
359
|
`ATEL_BSC_PRIVATE_KEY` environment variables and set `preferredChain` in the
|
|
360
360
|
registry metadata as a marketplace hint. This is purely cosmetic — it does not
|
|
361
361
|
affect whether you can execute a paid order.
|
|
@@ -5,9 +5,13 @@ Every completed task generates a cryptographic proof (ExecutionTrace → Merkle
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
#
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
# Base (primary)
|
|
9
|
+
export ATEL_BASE_PRIVATE_KEY=<hex-private-key>
|
|
10
|
+
export ATEL_BASE_RPC_URL=https://mainnet.base.org
|
|
11
|
+
|
|
12
|
+
# BSC (secondary)
|
|
13
|
+
export ATEL_BSC_PRIVATE_KEY=<hex-private-key>
|
|
14
|
+
export ATEL_BSC_RPC_URL=https://bsc-dataseed.binance.org
|
|
11
15
|
|
|
12
16
|
# Base (optional)
|
|
13
17
|
export ATEL_BASE_PRIVATE_KEY=<hex-key-with-0x>
|
|
@@ -61,7 +61,7 @@ Always ask before deciding any of the following:
|
|
|
61
61
|
anchors on behalf of agents using its own registered executor wallets and pays
|
|
62
62
|
gas. The user's smart wallet (AA) is automatically derived from the ATEL
|
|
63
63
|
identity key — no separate chain key is ever required to send or receive paid
|
|
64
|
-
orders. Any prompt asking for a "Base / BSC
|
|
64
|
+
orders. Any prompt asking for a "Base / BSC private key" is a legacy
|
|
65
65
|
V1 flow and should be declined.
|
|
66
66
|
|
|
67
67
|
Rules:
|
|
@@ -92,10 +92,6 @@ If the owner's preferred language is known, use the owner's language instead.
|
|
|
92
92
|
|
|
93
93
|
Do not spam the owner with every retry or low-level infrastructure event.
|
|
94
94
|
|
|
95
|
-
## Solana deposit caution
|
|
96
|
-
|
|
97
|
-
If guiding the owner to deposit USDC on Solana, tell them the transfer must use `transferChecked`.
|
|
98
|
-
Do not describe plain `transfer` as acceptable for Solana USDC deposits.
|
|
99
95
|
|
|
100
96
|
## Verify after upgrade
|
|
101
97
|
|
|
@@ -80,7 +80,7 @@ Agents below the threshold for a given risk level are rejected. Chain-verified p
|
|
|
80
80
|
# Local-only (default, uses .atel/trust-history.json)
|
|
81
81
|
atel check <did> medium
|
|
82
82
|
|
|
83
|
-
# Chain-verified (queries
|
|
83
|
+
# Chain-verified (queries Base/BSC RPC)
|
|
84
84
|
atel check <did> medium --chain
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -13,7 +13,7 @@ This includes:
|
|
|
13
13
|
**Do NOT ask the owner for any on-chain private key.** In V2 the Platform
|
|
14
14
|
anchors on behalf of agents using its own registered executor wallets and
|
|
15
15
|
pays gas. The user's smart wallet (AA) is automatically derived from the
|
|
16
|
-
ATEL identity key — no separate Base/BSC
|
|
16
|
+
ATEL identity key — no separate Base/BSC key is ever required to
|
|
17
17
|
send or receive paid orders. Any prompt asking for a raw chain private key
|
|
18
18
|
is a legacy V1 flow and should be declined.
|
|
19
19
|
|
package/dist/anchor/solana.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Solana Anchor Provider.
|
|
3
|
-
*
|
|
4
|
-
* Anchors hashes on Solana using the official Memo Program
|
|
5
|
-
* (`MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr`).
|
|
6
|
-
*
|
|
7
|
-
* The memo content is formatted as `ATEL_ANCHOR:<hash>` so anchored
|
|
8
|
-
* transactions are easily identifiable.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* ⚠️ SECURITY: The `privateKey` (Base58-encoded) is used to sign
|
|
12
|
-
* transactions. Never hard-code it — use environment variables or a vault.
|
|
13
|
-
*/
|
|
14
|
-
import type { AnchorProvider, AnchorRecord, AnchorVerification } from './index.js';
|
|
15
|
-
/** Configuration for the Solana anchor provider */
|
|
16
|
-
export interface SolanaAnchorConfig {
|
|
17
|
-
/** Solana JSON-RPC endpoint URL */
|
|
18
|
-
rpcUrl: string;
|
|
19
|
-
/**
|
|
20
|
-
* Base58-encoded private key for signing transactions.
|
|
21
|
-
* Optional — if omitted the provider can only verify / lookup.
|
|
22
|
-
*
|
|
23
|
-
* ⚠️ SECURITY: Keep this value secret.
|
|
24
|
-
*/
|
|
25
|
-
privateKey?: string;
|
|
26
|
-
}
|
|
27
|
-
/** Structured anchor metadata for v2 memo */
|
|
28
|
-
export interface AnchorMemoV2 {
|
|
29
|
-
version: 1;
|
|
30
|
-
executorDid: string;
|
|
31
|
-
requesterDid: string;
|
|
32
|
-
taskId: string;
|
|
33
|
-
traceRoot: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Anchor provider for the Solana blockchain.
|
|
37
|
-
*/
|
|
38
|
-
export declare class SolanaAnchorProvider implements AnchorProvider {
|
|
39
|
-
readonly name = "Solana";
|
|
40
|
-
readonly chain = "solana";
|
|
41
|
-
/** Solana RPC connection */
|
|
42
|
-
private readonly connection;
|
|
43
|
-
/** Keypair for signing (undefined when no private key is supplied) */
|
|
44
|
-
private readonly keypair?;
|
|
45
|
-
/** Default Solana mainnet-beta RPC URL */
|
|
46
|
-
static readonly DEFAULT_RPC_URL = "https://api.mainnet-beta.solana.com";
|
|
47
|
-
/**
|
|
48
|
-
* @param config - RPC URL and optional private key.
|
|
49
|
-
* If `rpcUrl` is omitted, the Solana mainnet-beta default is used.
|
|
50
|
-
*/
|
|
51
|
-
constructor(config?: Partial<SolanaAnchorConfig>);
|
|
52
|
-
/**
|
|
53
|
-
* Encode a hash into the memo data buffer (v2 structured format).
|
|
54
|
-
* Falls back to legacy format if no metadata provided.
|
|
55
|
-
*/
|
|
56
|
-
static encodeMemo(hash: string, meta?: {
|
|
57
|
-
executorDid?: string;
|
|
58
|
-
requesterDid?: string;
|
|
59
|
-
taskId?: string;
|
|
60
|
-
}): Buffer;
|
|
61
|
-
/**
|
|
62
|
-
* Decode a hash from memo data. Supports both v2 structured and legacy format.
|
|
63
|
-
*
|
|
64
|
-
* @returns The decoded hash, or `null` if the data doesn't match.
|
|
65
|
-
*/
|
|
66
|
-
static decodeMemo(data: Buffer | Uint8Array | string): string | null;
|
|
67
|
-
/**
|
|
68
|
-
* Decode full structured memo (v2 only).
|
|
69
|
-
* Returns null for legacy format memos.
|
|
70
|
-
*/
|
|
71
|
-
static decodeMemoV2(data: Buffer | Uint8Array | string): AnchorMemoV2 | null;
|
|
72
|
-
/** @inheritdoc */
|
|
73
|
-
anchor(hash: string, metadata?: Record<string, unknown>): Promise<AnchorRecord>;
|
|
74
|
-
/** @inheritdoc */
|
|
75
|
-
verify(hash: string, txHash: string): Promise<AnchorVerification>;
|
|
76
|
-
/** @inheritdoc */
|
|
77
|
-
lookup(hash: string): Promise<AnchorRecord[]>;
|
|
78
|
-
/** @inheritdoc */
|
|
79
|
-
isAvailable(): Promise<boolean>;
|
|
80
|
-
/**
|
|
81
|
-
* Query all ATEL anchor transactions for a given wallet address.
|
|
82
|
-
* Parses v2 structured memos to extract DID and task info.
|
|
83
|
-
*
|
|
84
|
-
* @param walletAddress - Solana wallet public key (base58)
|
|
85
|
-
* @param options - limit (default 100), filterDid (only return records involving this DID)
|
|
86
|
-
* @returns Array of parsed anchor memos with tx info
|
|
87
|
-
*/
|
|
88
|
-
queryByWallet(walletAddress: string, options?: {
|
|
89
|
-
limit?: number;
|
|
90
|
-
filterDid?: string;
|
|
91
|
-
}): Promise<Array<AnchorMemoV2 & {
|
|
92
|
-
txHash: string;
|
|
93
|
-
blockTime?: number;
|
|
94
|
-
}>>;
|
|
95
|
-
}
|