agentwallet-sdk 4.0.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/package.json +6 -59
- package/README.md +0 -132
- package/dist/__tests__/identity.did.test.d.ts +0 -2
- package/dist/__tests__/identity.did.test.d.ts.map +0 -1
- package/dist/__tests__/identity.did.test.js +0 -56
- package/dist/__tests__/identity.did.test.js.map +0 -1
- package/dist/__tests__/staking.test.d.ts +0 -2
- package/dist/__tests__/staking.test.d.ts.map +0 -1
- package/dist/__tests__/staking.test.js +0 -70
- package/dist/__tests__/staking.test.js.map +0 -1
- package/dist/__tests__/verify.test.d.ts +0 -2
- package/dist/__tests__/verify.test.d.ts.map +0 -1
- package/dist/__tests__/verify.test.js +0 -57
- package/dist/__tests__/verify.test.js.map +0 -1
- package/dist/abi.d.ts +0 -47
- package/dist/abi.d.ts.map +0 -1
- package/dist/abi.js +0 -257
- package/dist/abi.js.map +0 -1
- package/dist/bridge/abis.d.ts +0 -64
- package/dist/bridge/abis.d.ts.map +0 -1
- package/dist/bridge/abis.js +0 -131
- package/dist/bridge/abis.js.map +0 -1
- package/dist/bridge/client.d.ts +0 -50
- package/dist/bridge/client.d.ts.map +0 -1
- package/dist/bridge/client.js +0 -232
- package/dist/bridge/client.js.map +0 -1
- package/dist/bridge/index.d.ts +0 -3
- package/dist/bridge/index.d.ts.map +0 -1
- package/dist/bridge/index.js +0 -5
- package/dist/bridge/index.js.map +0 -1
- package/dist/bridge/types.d.ts +0 -53
- package/dist/bridge/types.d.ts.map +0 -1
- package/dist/bridge/types.js +0 -55
- package/dist/bridge/types.js.map +0 -1
- package/dist/identity/did.d.ts +0 -66
- package/dist/identity/did.d.ts.map +0 -1
- package/dist/identity/did.js +0 -186
- package/dist/identity/did.js.map +0 -1
- package/dist/identity/erc8004.d.ts +0 -150
- package/dist/identity/erc8004.d.ts.map +0 -1
- package/dist/identity/erc8004.js +0 -382
- package/dist/identity/erc8004.js.map +0 -1
- package/dist/identity/index.d.ts +0 -3
- package/dist/identity/index.d.ts.map +0 -1
- package/dist/identity/index.js +0 -3
- package/dist/identity/index.js.map +0 -1
- package/dist/index.d.ts +0 -7190
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -372
- package/dist/index.js.map +0 -1
- package/dist/plugins/elizaos.d.ts +0 -40
- package/dist/plugins/elizaos.d.ts.map +0 -1
- package/dist/plugins/elizaos.js +0 -91
- package/dist/plugins/elizaos.js.map +0 -1
- package/dist/policy/SpendingPolicy.d.ts +0 -32
- package/dist/policy/SpendingPolicy.d.ts.map +0 -1
- package/dist/policy/SpendingPolicy.js +0 -157
- package/dist/policy/SpendingPolicy.js.map +0 -1
- package/dist/staking/AgentStakingPool.d.ts +0 -100
- package/dist/staking/AgentStakingPool.d.ts.map +0 -1
- package/dist/staking/AgentStakingPool.js +0 -298
- package/dist/staking/AgentStakingPool.js.map +0 -1
- package/dist/staking/index.d.ts +0 -2
- package/dist/staking/index.d.ts.map +0 -1
- package/dist/staking/index.js +0 -2
- package/dist/staking/index.js.map +0 -1
- package/dist/swap/SwapModule.d.ts +0 -45
- package/dist/swap/SwapModule.d.ts.map +0 -1
- package/dist/swap/SwapModule.js +0 -146
- package/dist/swap/SwapModule.js.map +0 -1
- package/dist/swap/abi.d.ts +0 -51
- package/dist/swap/abi.d.ts.map +0 -1
- package/dist/swap/abi.js +0 -120
- package/dist/swap/abi.js.map +0 -1
- package/dist/swap/index.d.ts +0 -4
- package/dist/swap/index.d.ts.map +0 -1
- package/dist/swap/index.js +0 -6
- package/dist/swap/index.js.map +0 -1
- package/dist/swap/types.d.ts +0 -17
- package/dist/swap/types.d.ts.map +0 -1
- package/dist/swap/types.js +0 -19
- package/dist/swap/types.js.map +0 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -11
- package/dist/types.js.map +0 -1
- package/dist/verify/index.d.ts +0 -2
- package/dist/verify/index.d.ts.map +0 -1
- package/dist/verify/index.js +0 -2
- package/dist/verify/index.js.map +0 -1
- package/dist/verify/verifyAgent.d.ts +0 -42
- package/dist/verify/verifyAgent.d.ts.map +0 -1
- package/dist/verify/verifyAgent.js +0 -216
- package/dist/verify/verifyAgent.js.map +0 -1
- package/dist/x402/budget.d.ts +0 -44
- package/dist/x402/budget.d.ts.map +0 -1
- package/dist/x402/budget.js +0 -115
- package/dist/x402/budget.js.map +0 -1
- package/dist/x402/chains/abstract/index.d.ts +0 -107
- package/dist/x402/chains/abstract/index.d.ts.map +0 -1
- package/dist/x402/chains/abstract/index.js +0 -192
- package/dist/x402/chains/abstract/index.js.map +0 -1
- package/dist/x402/client.d.ts +0 -46
- package/dist/x402/client.d.ts.map +0 -1
- package/dist/x402/client.js +0 -207
- package/dist/x402/client.js.map +0 -1
- package/dist/x402/index.d.ts +0 -6
- package/dist/x402/index.d.ts.map +0 -1
- package/dist/x402/index.js +0 -10
- package/dist/x402/index.js.map +0 -1
- package/dist/x402/middleware.d.ts +0 -37
- package/dist/x402/middleware.d.ts.map +0 -1
- package/dist/x402/middleware.js +0 -67
- package/dist/x402/middleware.js.map +0 -1
- package/dist/x402/types.d.ts +0 -8
- package/dist/x402/types.d.ts.map +0 -1
- package/dist/x402/types.js +0 -11
- package/dist/x402/types.js.map +0 -1
package/dist/swap/SwapModule.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// SwapModule — Uniswap V3 token swap aggregator with 0.875% protocol fee
|
|
3
|
-
import { encodeFunctionData, } from 'viem';
|
|
4
|
-
import { UniswapV3RouterAbi, UniswapV3QuoterV2Abi, ERC20Abi } from './abi.js';
|
|
5
|
-
import { PROTOCOL_FEE_BPS, DEFAULT_SLIPPAGE_BPS, UNISWAP_V3_BASE, } from './types.js';
|
|
6
|
-
const FEE_TIERS = [100, 500, 3000, 10000];
|
|
7
|
-
/** Calculate protocol fee: floor(amount * feeBps / 100_000) */
|
|
8
|
-
export function calcProtocolFee(amount, feeBps) {
|
|
9
|
-
return (amount * BigInt(feeBps)) / 100000n;
|
|
10
|
-
}
|
|
11
|
-
/** Apply slippage: floor(amount * (10_000 - slippageBps) / 10_000) */
|
|
12
|
-
export function applySlippage(amount, slippageBps) {
|
|
13
|
-
return (amount * BigInt(10000 - slippageBps)) / 10000n;
|
|
14
|
-
}
|
|
15
|
-
/** Encode deadline: block.timestamp + deadlineSecs */
|
|
16
|
-
export function calcDeadline(deadlineSecs) {
|
|
17
|
-
return BigInt(Math.floor(Date.now() / 1000) + deadlineSecs);
|
|
18
|
-
}
|
|
19
|
-
export class SwapModule {
|
|
20
|
-
constructor(publicClient, walletClient, accountAddress, config) {
|
|
21
|
-
this.publicClient = publicClient;
|
|
22
|
-
this.walletClient = walletClient;
|
|
23
|
-
this.accountAddress = accountAddress;
|
|
24
|
-
this.config = {
|
|
25
|
-
routerAddress: UNISWAP_V3_BASE.ROUTER,
|
|
26
|
-
quoterAddress: UNISWAP_V3_BASE.QUOTER_V2,
|
|
27
|
-
feeBps: PROTOCOL_FEE_BPS,
|
|
28
|
-
feeWallet: '0xff86829393C6C26A4EC122bE0Cc3E466Ef876AdD',
|
|
29
|
-
...config,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async getQuote(tokenIn, tokenOut, amountIn, options = {}) {
|
|
33
|
-
const slippageBps = options.slippageBps ?? DEFAULT_SLIPPAGE_BPS;
|
|
34
|
-
const tiersToTry = options.feeTiers ?? FEE_TIERS;
|
|
35
|
-
const feeAmount = calcProtocolFee(amountIn, this.config.feeBps);
|
|
36
|
-
const amountInNet = amountIn - feeAmount;
|
|
37
|
-
if (amountInNet <= 0n) {
|
|
38
|
-
throw new Error(`SwapModule: amountIn (${amountIn}) is too small — fee (${feeAmount}) exceeds input`);
|
|
39
|
-
}
|
|
40
|
-
let bestQuote = null;
|
|
41
|
-
for (const fee of tiersToTry) {
|
|
42
|
-
try {
|
|
43
|
-
const result = await this.publicClient.readContract({
|
|
44
|
-
address: this.config.quoterAddress,
|
|
45
|
-
abi: UniswapV3QuoterV2Abi,
|
|
46
|
-
functionName: 'quoteExactInputSingle',
|
|
47
|
-
args: [{ tokenIn, tokenOut, amount: amountInNet, fee, sqrtPriceLimitX96: 0n }],
|
|
48
|
-
});
|
|
49
|
-
const [amountOut, , , gasEstimate] = result;
|
|
50
|
-
if (!bestQuote || amountOut > bestQuote.amountOut) {
|
|
51
|
-
bestQuote = { amountOut, gasEstimate, feeTier: fee };
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// Pool doesn't exist for this fee tier
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (!bestQuote) {
|
|
59
|
-
throw new Error(`SwapModule: No Uniswap V3 pool found for ${tokenIn} → ${tokenOut} on Base.`);
|
|
60
|
-
}
|
|
61
|
-
const amountOutMinimum = applySlippage(bestQuote.amountOut, slippageBps);
|
|
62
|
-
const effectiveRate = amountInNet > 0n ? Number(bestQuote.amountOut) / Number(amountInNet) : 0;
|
|
63
|
-
return {
|
|
64
|
-
tokenIn, tokenOut, amountInRaw: amountIn, amountInNet, feeAmount,
|
|
65
|
-
amountOut: bestQuote.amountOut, amountOutMinimum,
|
|
66
|
-
poolFeeTier: bestQuote.feeTier, effectiveRate, gasEstimate: bestQuote.gasEstimate,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async ensureApproval(token, spender, amount) {
|
|
70
|
-
const currentAllowance = (await this.publicClient.readContract({
|
|
71
|
-
address: token, abi: ERC20Abi, functionName: 'allowance',
|
|
72
|
-
args: [this.accountAddress, spender],
|
|
73
|
-
}));
|
|
74
|
-
if (currentAllowance >= amount)
|
|
75
|
-
return undefined;
|
|
76
|
-
const MAX_UINT256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935n;
|
|
77
|
-
const account = this.walletClient.account;
|
|
78
|
-
if (!account)
|
|
79
|
-
throw new Error('SwapModule: walletClient has no account');
|
|
80
|
-
const approveData = encodeFunctionData({
|
|
81
|
-
abi: ERC20Abi, functionName: 'approve', args: [spender, MAX_UINT256],
|
|
82
|
-
});
|
|
83
|
-
return this.walletClient.sendTransaction({
|
|
84
|
-
account, to: token, data: approveData, chain: this.walletClient.chain ?? null,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
async transferFee(token, feeAmount, feeWallet) {
|
|
88
|
-
const account = this.walletClient.account;
|
|
89
|
-
if (!account)
|
|
90
|
-
throw new Error('SwapModule: walletClient has no account');
|
|
91
|
-
const transferData = encodeFunctionData({
|
|
92
|
-
abi: ERC20Abi, functionName: 'transfer', args: [feeWallet, feeAmount],
|
|
93
|
-
});
|
|
94
|
-
return this.walletClient.sendTransaction({
|
|
95
|
-
account, to: token, data: transferData, chain: this.walletClient.chain ?? null,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
async swap(tokenIn, tokenOut, amountIn, options = {}) {
|
|
99
|
-
const slippageBps = options.slippageBps ?? DEFAULT_SLIPPAGE_BPS;
|
|
100
|
-
const deadlineSecs = options.deadlineSecs ?? 300;
|
|
101
|
-
const feeWallet = options.feeWallet ?? this.config.feeWallet;
|
|
102
|
-
const quote = await this.getQuote(tokenIn, tokenOut, amountIn, { slippageBps, feeTiers: options.feeTiers });
|
|
103
|
-
if (quote.gasEstimate > 2000000n) {
|
|
104
|
-
console.warn(`SwapModule: High gas estimate (${quote.gasEstimate}). Pool may be illiquid.`);
|
|
105
|
-
}
|
|
106
|
-
const approvalTxHash = await this.ensureApproval(tokenIn, this.config.routerAddress, amountIn);
|
|
107
|
-
const approvalRequired = approvalTxHash !== undefined;
|
|
108
|
-
let feeTxHash;
|
|
109
|
-
if (quote.feeAmount > 0n) {
|
|
110
|
-
feeTxHash = await this.transferFee(tokenIn, quote.feeAmount, feeWallet);
|
|
111
|
-
}
|
|
112
|
-
const account = this.walletClient.account;
|
|
113
|
-
if (!account)
|
|
114
|
-
throw new Error('SwapModule: walletClient has no account');
|
|
115
|
-
const deadline = calcDeadline(deadlineSecs);
|
|
116
|
-
const swapData = encodeFunctionData({
|
|
117
|
-
abi: UniswapV3RouterAbi,
|
|
118
|
-
functionName: 'exactInputSingle',
|
|
119
|
-
args: [{
|
|
120
|
-
tokenIn, tokenOut, fee: quote.poolFeeTier, recipient: this.accountAddress,
|
|
121
|
-
amountIn: quote.amountInNet, amountOutMinimum: quote.amountOutMinimum, sqrtPriceLimitX96: 0n,
|
|
122
|
-
}],
|
|
123
|
-
});
|
|
124
|
-
const txHash = await this.walletClient.sendTransaction({
|
|
125
|
-
account, to: this.config.routerAddress, data: swapData, chain: this.walletClient.chain ?? null,
|
|
126
|
-
});
|
|
127
|
-
return { txHash, feeTxHash, quote, approvalRequired, approvalTxHash };
|
|
128
|
-
}
|
|
129
|
-
getConfig() {
|
|
130
|
-
return { ...this.config };
|
|
131
|
-
}
|
|
132
|
-
setFeeWallet(address) {
|
|
133
|
-
this.config.feeWallet = address;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
export function attachSwap(wallet, config) {
|
|
137
|
-
const swapModule = new SwapModule(wallet.publicClient, wallet.walletClient, wallet.address, config);
|
|
138
|
-
return {
|
|
139
|
-
...wallet,
|
|
140
|
-
swapModule,
|
|
141
|
-
swap: swapModule.swap.bind(swapModule),
|
|
142
|
-
getQuote: swapModule.getQuote.bind(swapModule),
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
//# sourceMappingURL=SwapModule.js.map
|
|
146
|
-
//# sourceMappingURL=SwapModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SwapModule.js","sourceRoot":"","sources":["../../src/swap/SwapModule.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,yEAAyE;AACzE,OAAO,EAAE,kBAAkB,GAAG,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAA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M,EAAE,CAAC;IAC9B,CAAC;IACD,YAAY,CAAC,OAAO;QAChB,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC;IACpC,CAAC;CACJ;AACD,MAAM,UAAU,UAAU,CAAC,MAAM,EAAE,MAAM;IACrC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpG,OAAO;QACH,GAAG,MAAM;QACT,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;KACjD,CAAC;AACN,CAAC;AACD,sCAAsC"}
|
package/dist/swap/abi.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** Uniswap V3 SwapRouter02 ABI — exactInputSingle */
|
|
2
|
-
export declare const UniswapV3RouterAbi: {
|
|
3
|
-
name: string;
|
|
4
|
-
type: string;
|
|
5
|
-
stateMutability: string;
|
|
6
|
-
inputs: {
|
|
7
|
-
name: string;
|
|
8
|
-
type: string;
|
|
9
|
-
components: {
|
|
10
|
-
name: string;
|
|
11
|
-
type: string;
|
|
12
|
-
}[];
|
|
13
|
-
}[];
|
|
14
|
-
outputs: {
|
|
15
|
-
name: string;
|
|
16
|
-
type: string;
|
|
17
|
-
}[];
|
|
18
|
-
}[];
|
|
19
|
-
/** Uniswap V3 QuoterV2 ABI — quoteExactInputSingle */
|
|
20
|
-
export declare const UniswapV3QuoterV2Abi: {
|
|
21
|
-
name: string;
|
|
22
|
-
type: string;
|
|
23
|
-
stateMutability: string;
|
|
24
|
-
inputs: {
|
|
25
|
-
name: string;
|
|
26
|
-
type: string;
|
|
27
|
-
components: {
|
|
28
|
-
name: string;
|
|
29
|
-
type: string;
|
|
30
|
-
}[];
|
|
31
|
-
}[];
|
|
32
|
-
outputs: {
|
|
33
|
-
name: string;
|
|
34
|
-
type: string;
|
|
35
|
-
}[];
|
|
36
|
-
}[];
|
|
37
|
-
/** Minimal ERC-20 ABI for allowance, approve, transferFrom */
|
|
38
|
-
export declare const ERC20Abi: {
|
|
39
|
-
name: string;
|
|
40
|
-
type: string;
|
|
41
|
-
stateMutability: string;
|
|
42
|
-
inputs: {
|
|
43
|
-
name: string;
|
|
44
|
-
type: string;
|
|
45
|
-
}[];
|
|
46
|
-
outputs: {
|
|
47
|
-
name: string;
|
|
48
|
-
type: string;
|
|
49
|
-
}[];
|
|
50
|
-
}[];
|
|
51
|
-
//# sourceMappingURL=abi.d.ts.map
|
package/dist/swap/abi.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../src/swap/abi.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;GAwC9B,CAAC;AACF,sDAAsD;AACtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;GAyBhC,CAAC;AACF,8DAA8D;AAC9D,eAAO,MAAM,QAAQ;;;;;;;;;;;;GA6CpB,CAAC"}
|
package/dist/swap/abi.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// [MAX-ADDED] ABIs for Uniswap V3 SwapRouter02 and QuoterV2 on Base Mainnet
|
|
3
|
-
/** Uniswap V3 SwapRouter02 ABI — exactInputSingle */
|
|
4
|
-
export const UniswapV3RouterAbi = [
|
|
5
|
-
{
|
|
6
|
-
name: 'exactInputSingle',
|
|
7
|
-
type: 'function',
|
|
8
|
-
stateMutability: 'payable',
|
|
9
|
-
inputs: [
|
|
10
|
-
{
|
|
11
|
-
name: 'params',
|
|
12
|
-
type: 'tuple',
|
|
13
|
-
components: [
|
|
14
|
-
{ name: 'tokenIn', type: 'address' },
|
|
15
|
-
{ name: 'tokenOut', type: 'address' },
|
|
16
|
-
{ name: 'fee', type: 'uint24' },
|
|
17
|
-
{ name: 'recipient', type: 'address' },
|
|
18
|
-
{ name: 'amountIn', type: 'uint256' },
|
|
19
|
-
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
20
|
-
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'exactInput',
|
|
28
|
-
type: 'function',
|
|
29
|
-
stateMutability: 'payable',
|
|
30
|
-
inputs: [
|
|
31
|
-
{
|
|
32
|
-
name: 'params',
|
|
33
|
-
type: 'tuple',
|
|
34
|
-
components: [
|
|
35
|
-
{ name: 'path', type: 'bytes' },
|
|
36
|
-
{ name: 'recipient', type: 'address' },
|
|
37
|
-
{ name: 'amountIn', type: 'uint256' },
|
|
38
|
-
{ name: 'amountOutMinimum', type: 'uint256' },
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
outputs: [{ name: 'amountOut', type: 'uint256' }],
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
/** Uniswap V3 QuoterV2 ABI — quoteExactInputSingle */
|
|
46
|
-
export const UniswapV3QuoterV2Abi = [
|
|
47
|
-
{
|
|
48
|
-
name: 'quoteExactInputSingle',
|
|
49
|
-
type: 'function',
|
|
50
|
-
stateMutability: 'nonpayable',
|
|
51
|
-
inputs: [
|
|
52
|
-
{
|
|
53
|
-
name: 'params',
|
|
54
|
-
type: 'tuple',
|
|
55
|
-
components: [
|
|
56
|
-
{ name: 'tokenIn', type: 'address' },
|
|
57
|
-
{ name: 'tokenOut', type: 'address' },
|
|
58
|
-
{ name: 'amount', type: 'uint256' },
|
|
59
|
-
{ name: 'fee', type: 'uint24' },
|
|
60
|
-
{ name: 'sqrtPriceLimitX96', type: 'uint160' },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
outputs: [
|
|
65
|
-
{ name: 'amountOut', type: 'uint256' },
|
|
66
|
-
{ name: 'sqrtPriceX96After', type: 'uint160' },
|
|
67
|
-
{ name: 'initializedTicksCrossed', type: 'uint32' },
|
|
68
|
-
{ name: 'gasEstimate', type: 'uint256' },
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
/** Minimal ERC-20 ABI for allowance, approve, transferFrom */
|
|
73
|
-
export const ERC20Abi = [
|
|
74
|
-
{
|
|
75
|
-
name: 'allowance',
|
|
76
|
-
type: 'function',
|
|
77
|
-
stateMutability: 'view',
|
|
78
|
-
inputs: [
|
|
79
|
-
{ name: 'owner', type: 'address' },
|
|
80
|
-
{ name: 'spender', type: 'address' },
|
|
81
|
-
],
|
|
82
|
-
outputs: [{ name: '', type: 'uint256' }],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'approve',
|
|
86
|
-
type: 'function',
|
|
87
|
-
stateMutability: 'nonpayable',
|
|
88
|
-
inputs: [
|
|
89
|
-
{ name: 'spender', type: 'address' },
|
|
90
|
-
{ name: 'amount', type: 'uint256' },
|
|
91
|
-
],
|
|
92
|
-
outputs: [{ name: '', type: 'bool' }],
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'transfer',
|
|
96
|
-
type: 'function',
|
|
97
|
-
stateMutability: 'nonpayable',
|
|
98
|
-
inputs: [
|
|
99
|
-
{ name: 'to', type: 'address' },
|
|
100
|
-
{ name: 'amount', type: 'uint256' },
|
|
101
|
-
],
|
|
102
|
-
outputs: [{ name: '', type: 'bool' }],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'balanceOf',
|
|
106
|
-
type: 'function',
|
|
107
|
-
stateMutability: 'view',
|
|
108
|
-
inputs: [{ name: 'account', type: 'address' }],
|
|
109
|
-
outputs: [{ name: '', type: 'uint256' }],
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'decimals',
|
|
113
|
-
type: 'function',
|
|
114
|
-
stateMutability: 'view',
|
|
115
|
-
inputs: [],
|
|
116
|
-
outputs: [{ name: '', type: 'uint8' }],
|
|
117
|
-
},
|
|
118
|
-
];
|
|
119
|
-
//# sourceMappingURL=abi.js.map
|
|
120
|
-
//# sourceMappingURL=abi.js.map
|
package/dist/swap/abi.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abi.js","sourceRoot":"","sources":["../../src/swap/abi.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,4EAA4E;AAC5E,qDAAqD;AACrD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B;QACI,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,SAAS;QAC1B,MAAM,EAAE;YACJ;gBACI,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACR,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;oBACpC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC/B,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;oBACtC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;oBACrC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC7C,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE;iBACjD;aACJ;SACJ;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KACpD;IACD;QACI,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,SAAS;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,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KAC3C;IACD;QACI,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KACzC;CACJ,CAAC;AACF,+BAA+B"}
|
package/dist/swap/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { SwapModule, attachSwap, calcProtocolFee, applySlippage, calcDeadline } from './SwapModule.js';
|
|
2
|
-
export { UniswapV3RouterAbi, UniswapV3QuoterV2Abi, ERC20Abi } from './abi.js';
|
|
3
|
-
export { BASE_TOKENS, UNISWAP_V3_BASE, PROTOCOL_FEE_BPS, DEFAULT_SLIPPAGE_BPS } from './types.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/swap/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/swap/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/swap/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
export { SwapModule, attachSwap, calcProtocolFee, applySlippage, calcDeadline } from './SwapModule.js';
|
|
3
|
-
export { UniswapV3RouterAbi, UniswapV3QuoterV2Abi, ERC20Abi } from './abi.js';
|
|
4
|
-
export { BASE_TOKENS, UNISWAP_V3_BASE, PROTOCOL_FEE_BPS, DEFAULT_SLIPPAGE_BPS } from './types.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/dist/swap/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swap/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClG,iCAAiC"}
|
package/dist/swap/types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Well-known Base Mainnet token addresses */
|
|
2
|
-
export declare const BASE_TOKENS: {
|
|
3
|
-
USDC: string;
|
|
4
|
-
WETH: string;
|
|
5
|
-
cbETH: string;
|
|
6
|
-
WNATIVE: string;
|
|
7
|
-
};
|
|
8
|
-
/** Uniswap V3 contract addresses on Base Mainnet (chain 8453) */
|
|
9
|
-
export declare const UNISWAP_V3_BASE: {
|
|
10
|
-
ROUTER: string;
|
|
11
|
-
QUOTER_V2: string;
|
|
12
|
-
};
|
|
13
|
-
/** Protocol fee in bps — 0.875% */
|
|
14
|
-
export declare const PROTOCOL_FEE_BPS = 770;
|
|
15
|
-
/** Default slippage in bps — 0.5% */
|
|
16
|
-
export declare const DEFAULT_SLIPPAGE_BPS = 50;
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/swap/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/swap/types.ts"],"names":[],"mappings":"AACA,8CAA8C;AAC9C,eAAO,MAAM,WAAW;;;;;CAKvB,CAAC;AACF,iEAAiE;AACjE,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AACF,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,KAAK,CAAC"}
|
package/dist/swap/types.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/** Well-known Base Mainnet token addresses */
|
|
3
|
-
export const BASE_TOKENS = {
|
|
4
|
-
USDC: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
5
|
-
WETH: '0x4200000000000000000000000000000000000006',
|
|
6
|
-
cbETH: '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22',
|
|
7
|
-
WNATIVE: '0x4200000000000000000000000000000000000006',
|
|
8
|
-
};
|
|
9
|
-
/** Uniswap V3 contract addresses on Base Mainnet (chain 8453) */
|
|
10
|
-
export const UNISWAP_V3_BASE = {
|
|
11
|
-
ROUTER: '0x2626664c2603336E57B271c5C0b26F421741e481',
|
|
12
|
-
QUOTER_V2: '0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a',
|
|
13
|
-
};
|
|
14
|
-
/** Protocol fee in bps — 0.875% */
|
|
15
|
-
export const PROTOCOL_FEE_BPS = 770;
|
|
16
|
-
/** Default slippage in bps — 0.5% */
|
|
17
|
-
export const DEFAULT_SLIPPAGE_BPS = 50;
|
|
18
|
-
//# sourceMappingURL=types.js.map
|
|
19
|
-
//# sourceMappingURL=types.js.map
|
package/dist/swap/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/swap/types.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,8CAA8C;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,IAAI,EAAE,4CAA4C;IAClD,IAAI,EAAE,4CAA4C;IAClD,KAAK,EAAE,4CAA4C;IACnD,OAAO,EAAE,4CAA4C;CACxD,CAAC;AACF,iEAAiE;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,MAAM,EAAE,4CAA4C;IACpD,SAAS,EAAE,4CAA4C;CAC1D,CAAC;AACF,mCAAmC;AACnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,qCAAqC;AACrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,iCAAiC"}
|
package/dist/types.d.ts
DELETED
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,0BAA0B;AAC1B,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,0BAA0B;AAC1B,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,MAAM,EAAE,IAAI;IACZ,cAAc,EAAE,KAAK;IACrB,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,GAAG;CACjB,CAAC;AACF,iCAAiC"}
|
package/dist/verify/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verify/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
package/dist/verify/index.js
DELETED
package/dist/verify/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/verify/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* verifyAgent — Agent Trust Bundle
|
|
3
|
-
*
|
|
4
|
-
* Generates a cryptographically signed trust bundle that proves:
|
|
5
|
-
* - The agent's DID (permanent, derived from private key)
|
|
6
|
-
* - The agent's wallet address (onchain)
|
|
7
|
-
* - The agent's staking balance in the AgentStakingPool
|
|
8
|
-
* - A reputation score (0-100) based on observable onchain data
|
|
9
|
-
* - TaskBridge task completion count (if API URL provided)
|
|
10
|
-
* - Wallet age in days
|
|
11
|
-
*
|
|
12
|
-
* The bundle is signed by the agent's DID, making it tamper-proof.
|
|
13
|
-
* Any third party can call verifyTrustBundle() to confirm authenticity.
|
|
14
|
-
*/
|
|
15
|
-
import { type Hex, type Address } from 'viem';
|
|
16
|
-
export type SupportedChain = 'base' | 'arbitrum';
|
|
17
|
-
export interface AgentTrustBundle {
|
|
18
|
-
did: string;
|
|
19
|
-
walletAddress: Address;
|
|
20
|
-
stakingBalance: bigint;
|
|
21
|
-
reputationScore: number;
|
|
22
|
-
taskBridgeTasksCompleted: number;
|
|
23
|
-
walletAgeDays: number;
|
|
24
|
-
verifiedAt: number;
|
|
25
|
-
signature: string;
|
|
26
|
-
}
|
|
27
|
-
export interface VerifyAgentParams {
|
|
28
|
-
privateKey: Hex;
|
|
29
|
-
chain: SupportedChain;
|
|
30
|
-
taskBridgeApiUrl?: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Generate a complete trust bundle for an agent.
|
|
34
|
-
* Fetches real onchain data for staking balance and wallet age.
|
|
35
|
-
*/
|
|
36
|
-
export declare function verifyAgent(params: VerifyAgentParams): Promise<AgentTrustBundle>;
|
|
37
|
-
/**
|
|
38
|
-
* Verify a trust bundle was signed by the claimed DID.
|
|
39
|
-
* Returns true if signature is valid.
|
|
40
|
-
*/
|
|
41
|
-
export declare function verifyTrustBundle(bundle: AgentTrustBundle): boolean;
|
|
42
|
-
//# sourceMappingURL=verifyAgent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verifyAgent.d.ts","sourceRoot":"","sources":["../../src/verify/verifyAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAA4B,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAexE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,GAAG,CAAC;IAChB,KAAK,EAAE,cAAc,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAuDD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuGtF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAyBnE"}
|